home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 145.9 KB | 4,011 lines | [TEXT/MPS ] |
- #########################################################################
- #########################################################################
- ## Copyright © Apple Computer, Inc. 1993-1997
- ## All rights reserved
- #########################################################################
- #########################################################################
- #
- # Library: TargetControl.lib
- #
- # Version: 2.1.4
- #
- # Description:
- # Contains all kinds of tasks to control the target. Many of
- # these tasks were in other libraries originally, some in the
- # Clouseau Project and others in the LQ Project.
- #
- # Contains:
- # open_control_panel()
- # alias_control_panel()
- # key_repeat_off()
- # reset_target_info()
- # target_machine()
- # target_processor()
- # target_fpu()
- # get_target_info()
- # target_control()
- # SelectPrinter()
- # SelectDesktopPrinter()
- # SelectATImageWriter()
- # SelectImageWriter()
- # SelectLaserWriter()
- # SelectLaserWriter300()
- # SelectLaserWriter8()
- # SelectLWSelect310()
- # SelectLQATImageWriter()
- # SelectLQImageWriter()
- # SelectPersonalLaserWriterSC()
- # SelectPersonalLWLS()
- # SelectStyleWriter()
- # SelectStyleWriterII()
- # SelectColorSW2400()
- # SelectLaserWriterGX()
- # SelectColorSW2400GX()
- # SelectPDDMakerGX()
- # ensure_screen_depth()
- # sys_vers()
- # VerifyGetInfo()
- # CheckExternalToolVersions()
- # SetUpGeneralControls()
- # reset()
- # target_info()
- # CPUstic()
- # restart_target()
- # EH_CrashRecover()
- # setMacsBugMacro()
- # MacsBugLog()
- # EnableProgramLinking()
- #
- # History:
- # Date: By: Changes:
- # 03/15/93 SBR Created for use with Launchquits (LQ Project)
- # 02/19/94 SBR Moved to Clouseau Project for everyone to use
- # 04/09/95 SBR Added support for QD GX Printer select:
- # Created: VerifyGetInfo(), SelectPDDMakerGX(),
- # Modified: SelectPrinter(), SelectDesktopPrinter(),
- # reset_target_info().
- # 07/19/95 SBR Moved in CheckExternalToolVersions and
- # TurnOffShutdownWarning from Launchquit Script.
- # Added support for ISO: OnTarget extn and ctrl
- # gathering once again!
- # 08/01/95 SBR Radar 1275886: use AEPost to store target info.
- # 08/05/95 SBR Radar 1272723: removed dependencies on MathTool.
- # 09/04/95 SBR Radar 1273927: updated header.
- # 09/05/95 SBR MSO added SelectColorSW2400.
- # 06/01/96 SBR/MSO Updated copyright header
- # 06/01/96 MSO Radar 1293546: Added SelectColorSW2400GX task
- # Radar 1293559: Added SelectLaserWriterGX task
- # Radar 1294574: Documented pSystemFiles parameter in reset_target_info
- # 08/27/96 BRL OnTarget extn and ctrl gathering removed once again!
- # mostly in reset_target_info...
- # Other mods for emergency launch/quit repairs
- # (fileTool/OnTarget version references removed)
- # set ScrollPrompt off
- # 09/27/96 BRL/MSO Added SPEC exception handling
- # 12/03/96 Masa changed call to abort_script(). Radar 1185040
- # 01/21/97 SBR Deleted older exception code and comments.
- # 01/27/97 SBR Added FileToolHost.vuLib, removed VUAidFKEY.lib.
- # 04/10/97 SBR Added EnableProgramLinking().
- # 04/17/97 SBR Fixed Radar 1377545 in restart_target().
- #
- #########################################################################
- #########################################################################
-
- Libraries
- "68040CacheSwitchCP.lib",
- "Additions.lib",
- "Clouseau.lib",
- "ExceptionHandling.lib",
- "MemoryCP.lib",
- "Message.lib",
- "Report.lib",
- "VUAid.lib",
-
- "FileTool.vuLib", # external to Clouseau (see SPEC S & L)
- "FileToolHost.vuLib", # external to Clouseau (see SPEC S & L)
- "OnTarget.Lib", # external to Clouseau (see SPEC S & L)
-
- "AEPost.vuLib", # Added for Radar 1276224
- "Arbitrator.vu",
- "Ivy Tool Declaration.vulib";
-
- #########################################################################
- # task open_control_panel(name, closeWindow, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Opens a system 7.0 type control panel passed in by name.
- # The control panel opens only the window control panels
- # if no name is passed.
- # Parameters: name: name of control panel to open
- # closeCPWindow: true: close Control Panels window after
- # success or failure
- # false: leave Control Panels window open
- # ignored if name is empty
- # v_level: verbosity level for log output
- # Returns: true if it was successfully opened
- # false if an error occured while attempting to open it.
- # Examples: open_control_panel("Map");
- # open_control_panel();
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 7/25/90 Alan Liu Creation as part of ControlPanelLib.vu for 007
- # 3/4/92 Jason Marsh Incorporated into Clouseau.Lib
- # 05/27/93 SBR Try to select control panel's alias in the Apple Menu
- # This depends on the new select_menuItem() in Clouseau.lib
- # 05/27/93 SBR Fixed closing Control Panels window for success and failure
- # 05/27/93 SBR Added v_level to errors
- # 11/08/93 SBR Added closeCPWindow parameter
- # 11/25/95 SBR Apple Menu name does not have to end with ' alias'
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task open_control_panel(name:="", closeCPWindow := true, v_level := 5)
- begin
- error := false;
- noErr := true;
-
- if name
- temp := select_menuItem(/{name}≈/,1,,,v_level); #first try opening the alias in the Apple menu
- if not temp
- begin
- ### Select Controls panel menu item to open control panels
- if (select_descriptor([menuitem t:"Control Panels" m:1],, v_level) = error)
- return RIncomplete("open_control_panel: could not select Control Panels menu item");
-
- if (await_presence([window t:"Control Panels" o:1]) = error)
- return error;
-
- if name = ""
- return(noErr); #return if no specific control panel is specified
-
- ### Save the names and rectangles of the current windows for restoration later
- try
- match [window t:$windowNames r:$windowRects];
- catch theError
- ExceptionDispatcher(theError,,{"match in open_control_panel() gathering", {name, closeCPWindow, v_level}});
-
-
- ### Type in the name of the control panel and open it. If closeCPWindow is true, close
- ### the Control Panels window behind it, otherwise leave it open.
-
- type_keys({name, 'latch', commandKey, "i"},v_level);
-
- if not _MatchBoolean([window t:/≈{name}≈/], true)
- begin
- if closeCPWindow
- key_eq('w',,v_level);
- key_eq('w',,v_level);
- return RIncomplete("open_control_panel: Could not find control panel named: {name}", v_level);
- end;
- else
- begin
- key_eq('w',,v_level);
-
- if closeCPWindow
- key_eq('o',5,v_level); # close the Control Panels window with cmd-option-o
- else
- key_eq('o',,v_level); # leave open the Control Panels window with cmd-o
- end;
- end;
-
- ### Handle the case where the control panel does not open
- if not await_presence([window t:name o:1])
- begin
- errMessage := '';
-
- ## check to see if a dialog came up
- if _MatchBoolean([window s:dialog o:1], true)
- begin
- errMessage := _Match([statictext w:1], true).t;
- _Type({ enterKey }); # Dismiss dialog
-
- errMessage := "open_control_panel: Unexpected dialog opening {name} control panel: " +
- errMessage;
- end;
-
- frontWindow := _Match([window o:1], true);
- if not (isMember(frontWindow.t, windowNames) = isMember(frontWindow.r, windowRects))
- key_eq('w',,v_level);
-
- if not errMessage
- errMessage:= "open_control_panel: Found {name} but it did not open correctly";
-
- return RIncomplete(errMessage, v_level);
- end;
-
- return noErr; ### Everything worked
- end;
-
-
- #########################################################################
- # task alias_control_panel(name, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Creates an alias to a system 7.0 type control panel passed
- # in by name, and put it in the Apple Menu Items folder.
- # Parameters: name: name of control panel to open
- # v_level: verbosity level for log output
- # Returns: true if it was successfully opened by alias
- # false if an error occured
- # Examples: alias_control_panel('Memory');
- # Assumptions: VUAid external tool
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 05/27/93 SBR created
- # 09/03/94 SBR Added error handling for Get Info on alias
- #########################################################################
- task alias_control_panel(name := 'Memory', v_level := 4)
- begin
- controlPanelsFolder := VUAid('findfolder',{'ctrl'}) + ":";
- if not VUAid('iconlocation', {controlPanelsFolder + name}) # check if item exists
- begin
- RIncomplete("alias_control_panel: Could not find control panel: {name}", v_level);
- RStatus("If it is there anyway, rebuild the desktop for the startup volume.", v_level);
- return false;
- end;
- appleMenuItemsFolder := VUAid('findfolder',{'amnu'}) + ":";
- theCPAlias := controlPanelsFolder + "{name} alias";
- theAMIAlias := appleMenuItemsFolder + "{name} alias";
-
- if VUAid('iconlocation', {theAMIAlias}) # delete existing alias from Apple Menu Items
- VUAid('delete', {theAMIAlias});
- if VUAid('iconlocation', {theCPAlias}) # and Control Panels folders if needed
- VUAid('delete', {theCPAlias});
-
- if not open_control_panel()
- return false;
-
- type_keys({name});
- select_menuItem('Make Alias',2,,true,6);
-
- key_eq('i');
- if not await_presence([window o:1 t:/{name} alias≈/])
- begin
- key_eq("ww",,v_level);
- return RIncomplete("alias_control_panel: Problem making an alias to control panel: {name}", v_level);
- end;
- key_eq('ww',,v_level);
-
- if not VUAid('move',{theCPAlias,appleMenuItemsFolder})
- return RIncomplete("alias_control_panel: Problem moving the alias to the Apple menu", v_level);
-
- ### Everything worked - double check
- if not await_presence([menuItem t:"{name} alias" m:1],,,,6) #verify the alias in the Apple menu
- return RIncomplete("alias_control_panel: The alias did not appear in the Apple menu", v_level);
- return true;
- end;
-
-
- #########################################################################
- # task key_repeat_off(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Turns off Keyboard repeat rate in Keyboard CDEV. This task was
- # created for certain CPUs with faulty network hardware. The
- # fault occurred when VU was telling Agent VU to press and release a
- # key, leaving the key pressed for seconds or more at a time.
- # The character repeated when a single instance was specified.
- # Parameters: v_level: verbosity level for log output
- # Returns: true
- # Examples: key_repeat_off();
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 07/14/92 JDM Incorporated into Clouseau.Lib.
- # 02/19/94 SBR Added check for 0 in low-memory system global keyThresh
- # (address 398, or 0x18E) to save time.
- #########################################################################
- task key_repeat_off(v_level := 5)
- begin
- ### Remove lines below if keyThresh (398) becomes unavailable or if you get bored
- keyRepeat := VUAid('GetMemory', {'byte','398'}); #7F = Off, 0 = On
- VUAid('Quit');
- keyRepeat := strToNum( keyRepeat ); #7F = Off, 0 = On
- if keyRepeat
- return true; #7F = Off, 0 = On
- ### Remove lines above if keyThresh (398) becomes unavailable
-
- if not open_control_panel("Keyboard")
- return RIncomplete("key_repeat_off: Unable to open keyboard CDEV");
- move_mouse({{140,50}, 'click'});
- key_eq("w");
- return true;
- end;
-
-
- #########################################################################
- # task reset_target_info(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: logs and stores information about the target for later use
- # Parameters: pSystemFiles: true: print System files and their versions
- # false: do not print System files
- # NOTE: Using v_level instead of pSystemFiles to regulate printing.
- # pSystemFiles does nothing. Leaving in for compatibility.
- # v_level: the verbosity level
- # Returns: nothing
- # Examples: reset_target_info(, 2);
- # Assumptions: VU 2.1, All external tools exist, versions are correct,
- # target Program Linking is on with Guest Access
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 03/15/93 SBR Created
- # 05/27/93 SBR changed g_Target_Info_ to an associate list
- # 05/27/93 SBR fixed a bug in the build version formatting
- # 05/28/93 SBR added items for New Heap type
- # 06/01/93 SBR changed task name to reset_target_info
- # 09/03/94 SBR Added error handling for target access
- # 09/10/94 SBR Added OnTarget access; converted to long integers
- # VU 2.1 Gestalt returns long integers, made changes for this.
- # 03/26/95 SBR Added Long Word at Zero (check for EvenBetterBusError)
- # 07/12/95 SBR Added pSystemFiles parameter
- # 08/01/95 SBR Added store target info for Radar 1275886
- # 06/01/96 MSO Documented pSystemFiles parameter for Radar 1294574
- # 08/27/96 BRL Removed OnTarget calls/FileTool version checking
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task reset_target_info(pSystemFiles := false, v_level:= 2)
- begin
- global g_Target_Info_;
- (*
- g_Target_Info_ is an associate list, which means we can add, remove or change an
- item without worrying about things like its ordinal in the list, or its global
- declaration in tasks. A few of the things are available from Gestalt directly
- or indirectly, most require special methods which are undesirable to use in
- some situations. Most importantly this information is available even when the
- target has failed.
-
- g_Target_Info_ =
- { TYPE DESCRIPTION
- { 'name',tName }, string target name
- { 'zone',tZone }, string target zone
- { 'machine',machStr }, string machine type (formatted)
- { 'machine#',machValue }, integer machine type (raw from Gestalt)
- { 'processor',procStr }, string processor type (formatted)
- { 'processor#',procValue }, integer processor type (raw from Gestalt)
- { 'fpu',fpuStr }, string floating point unit type (formatted)
- { 'fpu#',fpuValue }, integer floating point unit type (raw from Gestalt)
- { 'system',sysVersion }, string system version (from match)
- { 'rom family',romFStr }, string ROM family (formatted)
- { 'rom family#',romFValue }, integer ROM family (raw short)
- { 'rom version',romVStr }, string ROM build version (formatted)
- { 'rom version#',romVValue }, integer ROM build version (raw long)
- { 'rom checksum',romCStr }, string ROM checksum (formatted to Hex)
- { 'rom checksum#',romCValue }, string ROM checksum (raw long string)
- { 'ram physical',ramPStr }, string RAM physical (formatted)
- { 'ram physical#',ramPValue }, list RAM physical (raw from Gestalt)
- { 'ram logical',ramLStr }, string RAM logical (formatted)
- { 'ram logical',ramLValue }, list RAM logical (raw from Gestalt)
- { 'vm',vmStr }, string 'xM', 'Off', or 'Not available' (no MMU)
- { 'vm#',vmFlag }, Boolean True, False, or Undefined (no MMU)
- { '32',addr32Str }, string 'On', 'Off', or 'Not available' (24-Bit only)
- { '32#',addr32Flag }, Boolean True, False, or Undefined (24-Bit only)
- { 'screen setting','8-Bit Color' }, string e.g. '8-Bit Color' (formatted)
- { 'bit depth#',depthMode }, integer bit depth (raw short)
- { 'color#',colorFlag }, Boolean True, False; undefined for B/W only
- { '68040CacheCP',cache040Str }, string 'On', 'Off' or 'not a 68040'
- { '68040CacheCP#',cache040Flag }, Boolean True, False; undefined for not a 68040
- { 'heapTypeStr',heapTypeStr }, string 'Pre-Modern 24-bit', 'Pre-Modern 24-bit',
- 'Modern 32-bit' or 'Modern 32-bit (debugging)'
- { 'heapType#',heapType } integer heap type (non-zero for 32 bit memory managers)
- { 'QuickTime version',qTimeStr }, string QuickTime version (formatted)
- { 'QuickTime version#',qTimeValue } integer QuickTime version (raw from Gestalt)
- { 'startupVolume',startupVolume } string startup volume on the target
- { 'system folder',systemFolder } string full pathname of active system folder on the target
- { 'NIL value',nilStr } string long at zero to check writes to NIL (formatted to Hex)
- { 'NIL value#',nilValue } integer long at zero to check writes to NIL (raw long)
- ### extensions & controlpanels unused, see comments in reset_target_info()
- # { 'extensions',sysExtList } list list of target extensions (see OnTarget('vers')
- # { 'control panels',cpList } list list of target control panels (see OnTarget('vers')
- { 'MacsBugLogName',mbLogName } string name of MacsBug logs when they are created
- # { 'MemCP VM',{vmMode, vmFlag}, vmMode is a list: { sizeString, bsVolString }
- # { 'MemCP 32',{addr32Mode, addr32Flag}},
- # { 'MemCP RD',{rdMode, rdValue}},
- # { 'MemCP DC',{dcMode, dcValue }}
- };
- *)
-
- RStatus("Starting reading target configuration at {time_str(match [time],'h')}",2);
-
- temp := _Match([target]);
- tName := temp.t;
- tZone := temp.z;
- targetASID := {"machine {tName} of zone {tZone}"};
-
- # Store target info added for Radar 1275886
- storeTargetInfo := _MatchBoolean([actor t:"LQAssist"], true);
- if storeTargetInfo and isUndefined(g_Target_Info_)
- begin
- # Try to restore the info instead of gathering it again
- InitMessages();
- tMsg := SendMessage( {'LQAssist'}, targetASID, {'restore'}, true, 10 );
- if tMsg[1]
- begin
- println "reset_target_info: error requesting target info restore: {tMsg}";
- tMsg := false;
- end;
- else
- begin
- tMsg := true;
- end;
-
- if tMsg
- begin
- g_Target_Info_ := ReceiveMessage( targetASID, {'LQAssist'}, false, true, 10 );
- if g_Target_Info_[1]
- begin
- println "reset_target_info: error receiving Target Info: {g_Target_Info_}";
- g_Target_Info_ := undefined;
- end;
- else
- begin
- g_Target_Info_ := g_Target_Info_[2];
- if not g_Target_Info_
- begin
- storeTargetInfo := true;
- g_Target_Info_ := undefined;
- end;
- else
- begin
- storeTargetInfo := false; # no need to store it again
- end;
- end;
- end;
- end;
- else
- begin
- g_Target_Info_ := undefined;
- end;
-
- if isUndefined( g_Target_Info_ )
- begin
- # If there is no stored target information, we have to gather it all again.
- # This process takes about a minute, instead of a few seconds if stored.
-
- # Launch all external tools at the beginning
- VUAid ('initialize', true);
- VUAid('ReturnLongInts', true);
- #OnTarget('initialize',true); #9608.23 SBR Hacked out
- FileTool('initialize',true);
-
- temp := _Match([target]);
- tName := temp.t;
- tZone := temp.z;
-
- machList := target_machine();
- procList := target_processor();
- fpuList := target_fpu();
-
- temp := _Match([system]);
- sysVersion := temp.v;
-
- g_Target_Info_ := { { 'name',tName },
- { 'zone',tZone },
- { 'machine',machList[1] },
- { 'machine#',machList[2] },
- { 'processor',procList[1] },
- { 'processor#',procList[2] },
- { 'fpu',fpuList[1] },
- { 'fpu#',fpuList[2] },
- { 'system',sysVersion }
- };
-
- romBase := VUAid('GetMemory', {'long', 686}); #get the ROM base address
-
- #get ROM version word
- romFValue := VUAid('GetMemory', {'short', romBase + 8});
- romFStr := midstr(numToStr(romFValue,16), 3, 4); #drop the '0x'
-
- #get ROM build word
- romVValue := VUAid('GetMemory', {'short', romBase + 18});
- romVStr := midstr(numToStr(romVValue,16), 3, 4); #drop the '0x'
- if romVStr[1] ~= /[0-9]/
- dot := '.'; #e.g. 2.1A2 (0x21A2)
- else dot := ''; #e.g. D11C4 (0xDBC4)
- romVStrLen := card romVStr;
- for i := 1 to 4 - romVStrLen #pad to 4 hex digits
- romVStr := '0' + romVStr;
- romVStr := "{romVStr[1]}{dot}{strToNum('0x' + romVStr[2])}" +
- "{romVStr[3]}{strToNum('0x' + romVStr[4])}";
-
- #get ROM checksum at ROMBase
- romCValue := VUAid('GetMemory', {'long', romBase});
- romCStr := midstr(numToStr(romCValue,16), 3, 8); #drop the '0x'
- g_Target_Info_ := g_Target_Info_ + {
- { 'rom family',romFStr },
- { 'rom family#',romFValue },
- { 'rom version',romVStr },
- { 'rom version#',romVValue },
- { 'rom checksum',romCStr },
- { 'rom checksum#',romCValue }
- };
-
- ramPValue := _Gestalt('ram ')[2]; # Physical RAM in bytes
- wholeMB := ramPValue / 1048576;
- fractMB := ((ramPValue - (wholeMB * 1048576)) * 10) / 1048576;
- ramPStr := "{numToStr(wholeMB)}.{fractMB}"; # String value in megabytes
-
- ramLValue := _Gestalt('lram')[2]; # Logical RAM in bytes
- wholeMB := ramLValue / 1048576;
- fractMB := ((ramLValue - (wholeMB * 1048576)) * 10) / 1048576;
- ramLStr := "{numToStr(wholeMB)}.{fractMB}"; # String value in megabytes
- g_Target_Info_ := g_Target_Info_ + {
- { 'ram physical',ramPStr },
- { 'ram physical#',ramPValue },
- { 'ram logical',ramLStr },
- { 'ram logical#',ramLValue }
- };
-
- temp := _Gestalt('mmu ')[2];
- if temp = 0 begin
- vmFlag := undefined;
- vmStr := 'Not Available';
- end;
-
- else if _Gestalt('vm ')[2] = 1 begin
- vmFlag := true;
- vmStr := 'On';
- end;
- else begin
- vmFlag := false;
- vmStr := 'Off';
- end;
- g_Target_Info_ := g_Target_Info_ + {{ 'VM',vmStr },{ 'VM#',vmFlag }};
-
- temp := _Gestalt('addr')[2];
- if temp = 0 begin
- addr32Flag := undefined;
- addr32Str := 'Not Available';
- end;
- else if temp = 7 begin
- addr32Flag := true;
- addr32Str := 'On';
- end;
- else begin
- addr32Flag := false;
- addr32Str := 'Off';
- end;
- g_Target_Info_ := g_Target_Info_ + {{ '32',addr32Str },{ '32#',addr32Flag }};
-
- depthMode := VUAid('GetDepth');
- g_Target_Info_ := g_Target_Info_ + {{ 'bit depth',depthMode }};
-
- if VUAid('GetGray') begin
- if depthMode > 1 begin
- colorFlag := false;
- colorStr := 'Gray';
- end;
- else begin
- colorFlag := undefined;
- colorStr := 'Black and White';
- end;
- end;
- else begin
- colorFlag := true;
- colorStr := 'Color';
- end;
- g_Target_Info_ := g_Target_Info_ + { { 'screen setting',"{depthMode}-bit {colorStr}" },
- { 'bit depth#',depthMode },{ 'color#',colorFlag }
- };
-
- temp := CacheSwitchCP();
- if isUndefined(temp) begin
- cache040Flag := undefined;
- cache040Str := 'Target processor is not a 68040';
- end;
- else if temp begin
- cache040Flag := true;
- cache040Str := 'On';
- end;
- else begin
- cache040Flag := false;
- cache040Str := 'Off';
- end;
- g_Target_Info_ := g_Target_Info_ + {{ '68040CacheCP',cache040Str },
- { '68040CacheCP#',cache040Flag }};
-
- #examine the system heap type to check Memory Manager version
- #this byte is offset 0x1E from the base of the system heap
- heapType := VUAid('GetMemory', {'byte', VUAid('GetMemory', {'long', 678}) + 30});
- heapTypeStr := assoc(heapType,
- {
- { 0, 'Pre-Modern 24-bit' },
- { 1, 'Pre-Modern 32-bit' },
- { 3, 'Modern 32-bit' },
- { 7, 'Modern 32-bit (debugging)' }
- }
- );
- if isUndefined(heapTypeStr)
- heapTypeStr := "Unknown ({heapType})";
- g_Target_Info_ := g_Target_Info_ + {{ 'heapTypeStr',heapTypeStr },
- { 'heapType#',heapType }};
-
- temp := _Gestalt('qtim'); #get the QuickTime version
- # e.g. _Gestalt('qtim') returns { -5551, 28016 } -> not installed
- # e.g. _Gestalt('qtim') returns { 0, 23232512 } -> 0x01628000 -> version 1.6.2
- # e.g. _Gestalt('qtim') returns { 0, 33587200 } -> 0x02008000 -> version 2.0.0
- if not temp[1]
- begin
- quickTimeValue := temp[2];
- quickTimeStr := midstr(numToStr(quickTimeValue,16), 3, 8); #convert to hex, drop the '0x'
- quickTimeStrLen := card quickTimeStr;
- for i := 1 to 8 - quickTimeStrLen #pad to 8 hex digits
- quickTimeStr := '0' + quickTimeStr;
-
- #use strToNum to remove leading zero
- quickTimeStr := "Version {strToNum(quickTimeStr[1] + quickTimeStr[2])}." +
- quickTimeStr[3] + quickTimeStr[4];
- end;
- else if temp[1] = -5551 begin
- quickTimeValue := undefined;
- quickTimeStr := 'Not Installed';
- end;
- g_Target_Info_ := g_Target_Info_ + {{ 'QuickTimeStr',quickTimeStr },
- { 'QuickTime#',quickTimeValue }};
-
- # 'boot' Name of boot volume (only for VUAid 2.x)
- # 'amnu' Apple Menu Items folder
- # 'ctrl' Control Panels folder
- # 'desk' Desktop folder
- # 'extn' Extensions folder
- # 'pref' Preferences folder
- # 'prnt' PrintMonitor Documents folder
- # 'empt' Shared, network Trash folder
- # 'trsh' Single-user trash folder
- # 'strt' Startup Items folder
- # 'macs' current System Folder
- # 'temp' Temporary Items folder
-
- g_Target_Info_ := g_Target_Info_ + {{ 'StartupVolume',VUAid("FindFolder", {'boot'}) },
- { 'SystemFolder',VUAid("FindFolder", {'macs'}) }};
-
- ### can not use OnTarget to gather extension versions: only returns 50 items max
- ### current system folders have almost 80
- #theExts := OnTarget("vers",'system','extn')[2]; #9608.23 SBR Hacked out
- theExts := {};
- theExtsLen := card theExts;
- for i := 1 to theExtsLen
- begin
- thisExt := theExts[i];
- theExts[i] := {thisExt[1], {thisExt[2],thisExt[3]}};
- end;
-
- #theCPs := OnTarget("vers",'system','ctrl')[2]; #9608.23 SBR Hacked out
- theCPs := {};
- theCPsLen := card theCPs;
- for i := 1 to theCPsLen
- begin
- thisCP := theCPs[i];
- theCPs[i] := {thisCP[1], {thisCP[2],thisCP[3]}};
- end;
-
- g_Target_Info_ := g_Target_Info_ + { { 'Extensions',theExts },
- { 'ControlPanels',theCPs }};
-
- # name of new MacsBug logs when they are created
- g_Target_Info_ := g_Target_Info_ + {{ 'MacsBugLogName','LQCrashLog' }};
-
- # make a new folder for MacsBug logs when they are created
- startupVolume := get_target_info('startupVolume');
- mbLogPath := "{startupVolume}:MacsBug Logs (new)";
- if not FileExists("{mbLogPath}")[2]
- CreateFolder("{mbLogPath}");
-
- g_Target_Info_ := g_Target_Info_ + {{ 'MacsBugLogPath', mbLogPath }};
-
- # Get the long at zero (NIL pointer) to check writes to NIL and if EBBE is installed.
- # Usually the long at zero is set to 64K above the ROM base.
- # EvenBetterBusError sets it to 50FF8001 hex.
- nilValue := VUAid('GetMemory', {'long', 0}); #get the long word at zero
- nilStr := midstr(numToStr(nilValue,16), 3, 8); #drop the '0x'
-
- EBBEState := false;
- switch nilValue
- begin
- case romBase + 0x10000:
- nilStr := nilStr + ' (standard value)';
-
- case 0x50FF8001:
- begin
- nilStr := nilStr + ' (EvenBetterBusError is installed)';
- EBBEState := true;
- end;
-
- default:
- nilStr := nilStr + ' (unknown value)';
- end;
- g_Target_Info_ := g_Target_Info_ + {{ 'NIL value',nilStr },
- { 'NIL value#',nilValue },
- {'EBBE', EBBEState}};
-
- SetUpGeneralControls(); # turn off shutdown warning, set app's folder to default
-
- memoryCPInfo := MemoryCP('readOnly');
- if memoryCPInfo[1]
- RIncomplete('Could not read the Memory control panel, exiting script.');
- else
- memoryCPInfo := memoryCPInfo[4];
-
- memCPDC := assoc('dc', memoryCPInfo);
- memCP32 := assoc('32', memoryCPInfo);
- memCPMM := assoc('mm', memoryCPInfo);
- memCPVM := assoc('vm', memoryCPInfo);
- memCPRD := assoc('rd', memoryCPInfo);
-
- g_Target_Info_ := g_Target_Info_ + {{ 'memCPDC',memCPDC },{ 'memCP32',memCP32 },
- { 'memCPMM',memCPMM },{ 'memCPVM',memCPVM },
- { 'memCPRD',memCPRD }};
-
- # Quit all external tools at the end
- FileTool('quit');
- # OnTarget('quit'); #9608.23 SBR Hacked out
- VUAid ('quit');
-
- end; #if isUndefined( g_Target_Info_ )
- RStatus("Stopped reading target configuration at {time_str(match [time],'h')}",2);
-
- theSeed := randomSeed();
-
- if R_BeVerbose(v_level) # skip entirely to save time if not needed
- begin
- RStatus("TARGET INFORMATION •••••••••••••••••••••••••••••••••••••••••••••", v_level);
- RStatus(" Target Name: '{assoc('name',g_Target_Info_)}'", v_level);
- if assoc('zone',g_Target_Info_) <> '*'
- RStatus(" Target Zone: '{assoc('zone',g_Target_Info_)}'", v_level);
- RStatus(" Machine Type: " + assoc('machine',g_Target_Info_), v_level);
- RStatus(" Processor Type: " + assoc('processor',g_Target_Info_), v_level);
- RStatus(" FPU Type: " + assoc('fpu',g_Target_Info_), v_level);
- RStatus(" ROM Family: {assoc('rom family',g_Target_Info_)}",v_level);
- RStatus(" ROM Version: {assoc('rom version',g_Target_Info_)}",v_level);
- RStatus(" ROM CheckSum: {assoc('rom checksum',g_Target_Info_)}",v_level);
- RStatus(" System Version: {assoc('system',g_Target_Info_)}",v_level);
- # RStatus(" Enabler Version: ????",v_level);
- RStatus(" Physical RAM: {assoc('ram physical',g_Target_Info_)}", v_level);
- if assoc('VM#',g_Target_Info_)
- RStatus(" Logical RAM: {assoc('ram logical',g_Target_Info_)} (Virtual Memory + RAM Disk)", v_level);
- else
- RStatus(" Logical RAM: {assoc('ram logical',g_Target_Info_)} (Physical RAM - RAM Disk - odd bits)", v_level);
- RStatus(" Virtual Memory: {assoc('VM',g_Target_Info_)}", v_level);
- RStatus(" 32-Bit Addressing: {assoc('32',g_Target_Info_)}", v_level);
- RStatus(" System Heap Type: {assoc('heapTypeStr',g_Target_Info_)}", v_level);
- RStatus(" QuickTime: {assoc('QuickTimeStr',g_Target_Info_)}", v_level);
- if not isUndefined(assoc('68040CacheCP#',g_Target_Info_))
- RStatus(" 68040 Caches: {assoc('68040CacheCP',g_Target_Info_)}", v_level);
- RStatus(" Screen Depth: {assoc('screen setting',g_Target_Info_)}", v_level);
- RStatus(" Random Seed: {theSeed}", v_level);
- RStatus("∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞", v_level);
- RStatus(" Memory Control Panel:", v_level);
- if assoc('memCPDC',g_Target_Info_)
- RStatus(" Disk Cache: {assoc('memCPDC',g_Target_Info_)}", v_level);
- if assoc('memCP32',g_Target_Info_)
- RStatus(" 32-Bit Addressing: {assoc('memCP32',g_Target_Info_)}", v_level);
- if assoc('memCPMM',g_Target_Info_)
- RStatus(" Modern Memory Manager: {assoc('memCPMM',g_Target_Info_)}", v_level);
- if assoc('memCPVM',g_Target_Info_)
- RStatus(" Virtual Memory: {assoc('memCPVM',g_Target_Info_)}", v_level);
- if assoc('memCPRD',g_Target_Info_)
- RStatus(" RAM Disk: {assoc('memCPRD',g_Target_Info_)}", v_level);
- RStatus("∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞", v_level);
- RStatus(" Control Panels:", v_level);
- for each tFile in assoc('ControlPanels',g_Target_Info_)
- RStatus(" {tFile}", v_level);
- RStatus("∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞", v_level);
- RStatus(" Extensions:", v_level);
- for each tFile in assoc('Extensions',g_Target_Info_)
- RStatus(" {tFile}", v_level);
- RStatus("∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞", v_level);
- RStatus(" Long word at NIL: {assoc('NIL value',g_Target_Info_)}",v_level);
- RStatus("••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••", v_level);
- end;
-
- # Store target info added for Radar 1275886
- if storeTargetInfo
- begin
- tMsg := SendMessage( {'LQAssist'}, targetASID, g_Target_Info_, false, 10 );
- if tMsg[1]
- begin
- println "reset_target_info: error storing Target info: {tMsg}";
- tMsg := undefined;
- end;
- else
- begin
- tMsg := tMsg[2];
- end;
- end;
- end;
-
- #########################################################################
- # task target_machine(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Returns the name and number of the machine type returned by Gestalt
- #
- # WARNING: includes unreleased machine names; APPLE INTERNAL USE ONLY
- #
- # Parameters: v_level
- # Returns: {machStr or 'unknown', machValue}
- # Examples: myMachineStr := target_machine()[1];
- # Assumptions: VU 2.0
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 03/10/92 JDM Creation (called target_cpu in VUAid)
- # 01/06/93 SBR Rebuilt to use assoc and VU 2.0 Gestalt
- # 06/01/93 SBR Renamed from target_CPU_LQ to target_machine_LQ
- # 02/19/94 SBR Renamed from target_machine_LQ to target_machine
- # 09/13/94 SBR VU 2.1 Gestalt returns long integers; made changes for this.
- # 08/09/95 SBR Updated machine list for Radar 1275848.
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task target_machine(v_level := 4)
- begin
- machValue := _Gestalt('mach');
- err := machValue[1];
- if err begin
- RIncomplete("target_machine: Gestalt('mach') returned error #{err}", v_level);
- return {"unknown ({machValue})",-1};
- end;
- else machValue := machValue[2];
-
- machStr := assoc
- ( machValue,
- {
- {1, "128K, 512K"},
- {2, "XL"},
- {3, "512Ke"},
- {4, "Plus"},
- {5, "SE, SE FDHD"},
- {6, "II"},
- {7, "IIx"},
- {8, "IIcx"},
- {9, "SE/30"},
- {10, "Portable"},
- {11, "IIci"},
- {13, "IIfx"},
- {17, "Classic"},
- {18, "IIsi"},
- {19, "LC"},
- {20, "Quadra 900"},
- {21, "PowerBook 170"},
- {22, "Quadra 700"},
- {23, "Classic II, Performa 200"},
- {24, "PowerBook 100"},
- {25, "PowerBook 140"},
- {26, "Quadra 950, WG Server 95"},
- {27, "LC III, Performa 450"},
- {29, "PowerBook Duo 210"},
- {30, "Centris 650"},
- {32, "PowerBook Duo 230"},
- {33, "PowerBook 180"},
- {34, "PowerBook 160"},
- {35, "Quadra 800, WG Server 80"},
- {36, "Quadra 650"},
- {37, "LC II, Performa 400,405,410,430"},
- {38, "PowerBook Duo 250"},
- {39, "WG Server 9150"},
- {40, "Power 8100/110, 8115/110, WG Server 8150/110"},
- {41, "Power 5200/75 LC, Performa 5200,5210,5215,5220"},
- {42, "Power 6200/75, Performa 6200,6216,6218,6220,6230"},
- {43, "Cyclone33•"},
- {44, "IIvi"},
- {45, "Performa 600" (*IIvm•*)},
- {47, "Power 7100/80, 7100/80AV"},
- {48, "IIvx"},
- {49, "Color Classic, Color Classic II, Performa 250,275"},
- {50, "PowerBook 165c"},
- {52, "Centris 610, WG Server 60, WG Server 60 (50/25 MHz)"},
- {53, "Quadra 610, Quadra 610 DOS Compatible"},
- {54, "PowerBook 145,145B"},
- {55, "Power 8100/100, 8100/100AV"},
- {56, "LC 520, Performa 520"},
- {57, "WG Server 9150/120"},
- {60, "Centris 660AV, Quadra 660AV"},
- {61, "Smurf700•"},
- {62, "LC III+, Performa 460,466,467"},
- {64, "Power 8100/60•"},
- {65, "Power 8100/80, 8100/80AV, WG Server 8150"},
- {66, "Power 8100/100•"},
- {67, "Power 9500/120, 9500/132" (*"Power 9500/132"*)},
- {68, "Power 7500/100"},
- {69, "Power 8500/120"},
- {71, "PowerBook 180c"},
- {72, "PowerBook 520,520c,540,540c"},
- {74, "PDM Evt 1 (R.I.P.)•"},
- {75, "Power 6100/60, 6100/60AV, Performa 6110,6112,6115,6116,6117,6118, WG Server 6150"},
- {77, "PowerBook Duo 270c" (*"Escher•"*)},
- {78, "Quadra 840AV"},
- {79, "Tempest33•"},
- {80, "LC 550, Performa 550,560"},
- {82, "Smurf650•"},
- {83, "Slice33•"},
- {84, "PowerBook 165"},
- {85, "PowerBook 165•"},
- {86, "Primus20•"},
- {87, "Optimus20•"},
- {88, "Mac TV" (*"HookTV•"*)},
- {89, "LC 475, Performa 475,476"},
- {90, "Primus33•"},
- {91, "Optimus25•"},
- {92, "LC 575, Performa 575,577,578" (*"Optimus33•"*)},
- {93, "Aladdin20•"},
- {94, "Quadra 605"},
- {95, "Aladdin33•"},
- {98, "LC 630, LC 630 DOS Compatible, Quadra 630, Performa 630,631,635,636,637,638,640 DOS Compatible" (*"Color Classic 040 (25)•"*)},
- {99, "LC 580, Performa 580,588" (*"Color Classic 040 (33)"*)},
- {100, "Power 6100/66, 6100/66AV, 6100/66 DOS Compatible, WG Server 6150/66"},
- {101, "Power 6100/80•"},
- {102, "PowerBook Duo 280"},
- {103, "PowerBook Duo 280c"},
- {104, "Power 475/605" (*"900 Smurf"*)},
- {105, "Power 575" (*"950 Smurf"*)},
- {106, "Power 630" (*"610 Smurf"*)},
- {107, "Power 580" (*"800 Smurf"*)},
- {108, "Power 7200/75" (*", 7200/90", "Q610 Smurf"*)},
- {109, "Q650 Smurf•"},
- {111, "Power 7100/60•"},
- {112, "Power 7100/66, 7100/66AV"},
- {113, "Power 7100/80•"},
- {115, "PowerBook 150"},
- {116, "Power 700"},
- {117, "Power 900"},
- {118, "Power 950"},
- {119, "Power C610"},
- {120, "Power C650"},
- {121, "Power Q610"},
- {122, "Power Q650"},
- {123, "Power 800"}
- }
- );
- if not machStr
- machStr := "unknown ({machValue})";
- return {machStr,machValue};
- end;
-
- #########################################################################
- # task target_processor(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Returns the name and number of the main processor returned by Gestalt
- # Parameters: v_level
- # Returns: {procStr or 'unknown', procValue}
- # Examples: myProcessorName := target_processor()[1];
- # Assumptions: VU 2.0
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 06/04/93 SBR Created
- # 02/19/94 SBR Renamed from target_processor_LQ to target_processor
- # 06/17/94 Gary Kratzer Added PowerPC support
- # 09/13/94 SBR VU 2.1 Gestalt returns long integers; made changes for this.
- # 09/23/94 SBR Changed 680x0 values (added 1 to each) to match Gestalt.equ.
- # These values need verifying on 7.1 and 7.5
- # 09/18/95 SBR Added 'PPC603e'.
- # Radar 1285671: Fix for unknown PowerPC processors.
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task target_processor(v_level:=5)
- begin
- PPCGestalt := true;
- procValue := _Gestalt('cput'); # Try new improved CPU-type Gestalt call
- if procValue[1] <> 0
- begin
- PPCGestalt := false;
- procValue := _Gestalt('proc'); # If it's not there, revert to old fashioned method
- end;
-
- err := procValue[1];
- if err
- begin
- RIncomplete("target_proc: Gestalt('proc') returned error #{err}", v_level);
- return {"unknown ({procValue})",-1};
- end;
- else
- procValue := procValue[2];
-
- # RStatus("target_processor: PPCGestalt = {PPCGestalt}, procValue = {procValue}",2);
- if PPCGestalt = true
- begin
- procStr := assoc( procValue,
- {
- # This set works on a Quadra 840AV, the other set is for System 7.5? Needs verifying on all CPUs
- # {1, '68000'},
- # {2, '68010'},
- # {3, '68020'},
- # {4, '68030'},
- # {5, '68040'},
- {0, '68000'},
- {1, '68010'},
- {2, '68020'},
- {3, '68030'},
- {4, '68040'},
- {257, 'PPC601'},
- {259, 'PPC603'},
- {260, 'PPC604'},
- {262, 'PPC603e'}
- });
-
- #Added for Radar 1285671
- if not procStr
- procStr := "PPC unknown ({procValue})";
- end;
-
- else
- begin
- procStr := assoc( procValue,
- {
- {1, '68000'},
- {2, '68010'},
- {3, '68020'},
- {4, '68030'},
- {5, '68040'}
- });
-
- #Added for Radar 1285671
- if not procStr
- procStr := "68K unknown ({procValue})";
- end;
-
- return {procStr,procValue};
- end;
-
-
- #########################################################################
- # task target_fpu(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Returns the name and number of the math coprocessor returned by Gestalt
- # Parameters: v_level
- # Returns: {fpuStr or 'unknown', fpuValue}
- # Examples: myFPUName := target_fpu()[1];
- # Assumptions: VU 2.0
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 05/24/93 SBR Created
- # 09/13/94 SBR VU 2.1 Gestalt returns long integers; made changes for this.
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task target_fpu(v_level := 5)
- begin
- fpuValue := _Gestalt('fpu ');
- err := fpuValue[1];
- if err begin
- RIncomplete("target_fpu: Gestalt('fpu ') returned error #{err}", v_level);
- return {'unknown',-1};
- end;
- else fpuValue := fpuValue[2];
-
- fpuStr := assoc( fpuValue,
- {
- {0, 'no FPU'},
- {1, '68881'},
- {2, '68882'},
- {3, '68040 built-in'}
- }
- );
- if not fpuStr
- fpuStr := "unknown ({fpuValue})";
- return {fpuStr,fpuValue};
- end;
-
-
- #########################################################################
- # task get_target_info(infoType, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Retrieves stored target information (see reset_target_info)
- # Parameters: infoType: string or list of strings specifying what kind of
- # information to look up
- # v_level
- # Returns: value or list of values corresponding to each member of infoType
- # Examples: laMachine := get_target_info('machine');
- # Assumptions: VU 2.0
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 06/04/93 SBR Created
- # 09/03/94 SBR Added warning for undefined
- #########################################################################
- task get_target_info(infoType := '', v_level := 4)
- begin
- global g_Target_Info_;
-
- if isUndefined(g_Target_Info_)
- begin
- RError('Someone called get_target_info() without first calling reset_target_info()',1);
- return undefined;
- end;
- if typeOf(infoType) = 'string'
- begin
- returnValue := assoc(infoType, g_Target_Info_);
- if RXStatus(v_level) # RXStatus for possible too-large strings
- println "get_target_info: retrieved value of type '{infoType}' is ", returnValue;
- end;
- else
- begin
- returnValue := {};
- for each iType in infoType
- begin
- temp := assoc(infoType, g_Target_Info_);
- if RXStatus(v_level) # RXStatus for possible too-large strings
- println "get_target_info: retrieved value of type '{infoType}' is ", returnValue;
- returnValue := returnValue + {temp};
- end;
- end;
- return returnValue;
- end;
-
-
- ##############################################################################################
- # target_control( theMode, zeroMode, v_level)
- #=============================================================================================
- # Author: SBR
- # Description: dispatches setup lists to other routines
- # Parameters: theMode: an integer standing for a pre-defined Memory control panel setup
- # zeroMode: a list of settings for mode 0 (custom)
- # Clicking the Use Defaults button, {'ud','click'}, has these effects:
- # The Disk Cache is set according to a formula
- # If the RAM Disk is empty it is turned Off
- # If the 32-Bit section is visible it is set to 24-Bit
- # The VM backing store volume is set to the startup volume
- # The VM amount is set to twice the available built-in RAM
- # Returns: nothing
- # Examples: target_control(5);
- # Assumptions: none
- #=============================================================================================
- # History:
- # Date: By: Changes:
- # 03/15/93 SBR Created
- ##############################################################################################
- task target_control
- (
- theMode := 1,
- zeroMode := {
- { 'dc','96K' },
- { 'vm','Off'},
- { '32','On'},
- { 'rd','Off'},
- { 'ud','click'},
- 'quick'
- },
- v_level := 3
- )
- begin
- #RPushVerbosity(v_level);
-
- theModes :=
- {
- # Standard modes
- { 1, { { 'vm',{ 'auto','' } },
- { '32','On' },
- { 'ud','click' },
- 'quick' } },
- { 2, { { 'vm',{ 'Off','' } },
- { '32','On' },
- { 'ud','click' },
- 'quick' } },
- { 3, { { 'vm',{ 'auto','' } },
- { '32','Off' },
- { 'ud','click' },
- 'quick' } },
- { 4, { { 'vm',{ 'Off','' } },
- { '32','Off' },
- { 'ud','click' },
- 'quick' } },
- { 5, { { 'vm',{ 'random','' } },
- { 'mm','random' },
- { '32','random' },
- { 'rd','random' },
- { 'dc','random' },
- { 'ud','click' },
- 'quick' } },
- { 6, { { 'vm',{ 'auto','' } },
- { '32','On' },
- { 'rd','min' },
- { 'ud','click' },
- 'quick' } },
- { 7, { { 'vm',{ 'Off','' } },
- { '32','On' },
- { 'rd','max' },
- { 'dc','max' },
- { 'ud','click' },
- 'quick' } },
- { 8, { { 'vm',{ 'max','' } },
- { '32','On' },
- { 'rd','max' },
- { 'dc','max' },
- { 'ud','click' },
- 'quick' } },
- # { 9, { { 'vm',{ 'random','' } }, # mode 9 is undefined.
- # { '32','random' },
- # { 'rd','random' },
- # { 'dc','random' },
- # { 'ud','click' } } },
- { 0, zeroMode },
-
-
- # A la mode (takes up the last position so commas are not a worry
- {}
- };
-
- modeSet := theMode / 10;
- if modeSet = 0 begin # 0-9 imply New Memory Manager On (Faster) on PowerPC
- mmList := {'mm','On'};
- end;
- if modeSet = 3 begin # 30-39 are PowerPC with New Memory Manager Off (More Compatible)
- theMode := theMode - modeSet * 10;
- mmList := {'mm','Off'};
- end;
-
- theConfigList := assoc(theMode, theModes);
-
- if theConfigList
- begin
- if theMode <> 5
- theConfigList := theConfigList + {mmList};
- RStatus("target_control: Setting target to configuration {theMode}:",2);
- RStatus(" {theConfigList}",2);
- memoryCPResult := MemoryCP(theConfigList,2);
- restart_target(4);
-
- MacsBugLog('target_control restart');
- SetMacsBugMacro('restore',v_level);
-
- reset_target_info(v_level);
- return true;
- end;
- else return RIncomplete("target_control: '{theMode}' is invalid input. Please use 0-8 or 30-38");
- end;
-
- #########################################################################
- # task SelectPrinter(pType, pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a printer by typing its name in the Chooser.
- # Verifies by selecting Page Setup in the Finder and
- # checking statictext items in the dialog.
- # Parameters: pSelection:
- # string type of printer to select (Chooser extension file)
- # (this is the old way to use this task)
- # OR
- # List of two items, comprising a printer description:
- # [1]: string type of printer to select (Chooser extension file)
- # [2]: list of options for that kind of printer
- # OR
- # List of printer descriptions: Try each in order
- # until one succeeds. Fail if the last one fails.
- # v_level: verbosity level for log output
- # Returns: true if it was successfully opened
- # false if an error occured while attempting to open it.
- # Examples: SelectPrinter('Laserwriter');
- # SelectPrinter({'Laserwriter 8',{'name', 'Deep Space 10'}});
- # SelectPrinter({'LaserWriter,{}},{'Laserwriter 8',{'name', 'Deep Space 10'}});
- # Assumptions: 1) Task get_target_info() can return a list of extensions to check if a
- # printer type exists. If get_target_info() does not have a list
- # of extensions, then this task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect" in the Chooser.
- # 2) If you type a printer name, the lower level task verifies it
- # 3) Uses OnTarget 1.2.1 'vers' service format
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/27/93 SBR created
- # 08/27/94 SBR reformatted and commented
- # 09/03/94 SBR started moving to new printer select architecture
- # 04/09/95 SBR added support for GX printers
- # 09/05/95 MSO added SelectColorSW2400
- # 06/01/96 MSO uncommented SelectColorSW2400GX and SelectLaserWriterGX
- # 08/23/96 SBR Added special case if the Extensions list = {}
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectPrinter( pSelection := {'LaserWriter', {}}, v_level := 5)
- begin
- try begin
- # go to Finder
- previousApp := _Match([application]).t;
- if not twitch('Finder')
- throw "could not switch to the Finder.";
-
- pSelectionType := typeOf(pSelection);
-
- if pSelectionType = 'string' # to provide same behavior as old task
- pSelection := {{pSelection,{}}};
- else if (pSelectionType = 'list')
- begin
- if (typeOf(pSelection[1]) = 'string') # new format, single request
- pSelection := {pSelection};
- end;
- else
- throw "bad parameter: pSelection = {pSelection}";
-
- gesResult := _Gestalt('pmgr');
- if (gesResult[1] = 0) # if no error then GX print manager is installed
- begin
- printerDispatchTable :=
- {
- # Quickdraw GX Printers
- { 'Color SW 2400 GX', task SelectColorSW2400GX },
- # { 'ImageWriter GX', task SelectImageWriterGX },
- # { 'ImageWriter LQ GX', task SelectImageWriterLQGX },
- { 'LaserWriter GX', task SelectLaserWriterGX },
- # { 'LaserWriter IISC GX', task SelectLaserWriterIISCGX },
- # { 'LW 300/LS GX', task SelectLW300LSGX },
- { 'PDD Maker GX', task SelectPDDMakerGX }
- # { 'StyleWriter GX', task SelectStyleWriterGX }
- };
- end;
- else
- begin
- printerDispatchTable :=
- {
- # Postscript and Classic Quickdraw Printers
- { 'AppleTalk ImageWriter', task SelectATImageWriter },
- { 'ImageWriter', task SelectImageWriter },
- { 'LaserWriter', task SelectLaserWriter },
- { 'LaserWriter 300', task SelectLaserWriter300 },
- { 'LaserWriter 8', task SelectLaserWriter8 },
- { 'LW Select 310', task SelectLWSelect310 },
- { 'LQ AppleTalk ImageWriter', task SelectLQATImageWriter },
- { 'LQ ImageWriter', task SelectLQImageWriter },
- { 'Personal LaserWriter SC', task SelectPersonalLaserWriterSC },
- { 'Personal LW LS', task SelectPersonalLWLS },
- { 'StyleWriter', task SelectStyleWriter },
- { 'StyleWriter II', task SelectStyleWriterII },
- { 'Color SW 2400', task SelectColorSW2400 } # MSO 9/5/95 added
- };
- end;
-
- # by this time pSelection is a list of at least one printer description
- theExtensions := get_target_info('extensions');
- numExtensions := card theExtensions;
-
- for each printerDescription in pSelection
- begin
- try
- begin
- # parse the printer description
- printerType := printerDescription[1];
- printerSettings := printerDescription[2];
-
- # if contents of extensions folder are unknown, assume printer exists
- if isUndefined( theExtensions ) or (theExtensions = {})
- throw true;
-
- # check if printer file is in Extensions folder
- theExtensionSpecs := assoc(printerType, theExtensions);
- if not theExtensionSpecs
- throw false; # try the next selection
-
- # check version if specified
- extVersion := assoc('version',printerSettings);
- if extVersion
- begin
- if not (extVersion = theExtensionSpecs[2])
- throw false; # try the next selection
- else
- throw true;
- end;
- else
- throw true;
- end;
- catch theLoopTerminator
- begin
- if theLoopTerminator # we found an existing printer type
- begin
- # printer file of correct version exists, try to select it
- thePrinterTask := assoc(printerType, printerDispatchTable);
- if thePrinterTask
- begin
- printerSelectResult := call (thePrinterTask, printerSettings);
-
- if printerSelectResult[1]
- throw printerSelectResult;
- else
- begin
- twitch(previousApp);
- return true;
- end;
- end;
- else
- begin
- # do not throw here, let the loop continue
- #throw "no task exists to set printer type {printerType}";
- end;
- end;
- end;
- end;
- throw 'could not find any of the requested printers';
- end;
- catch thePrinterError
- begin
- RError("SelectPrinter: error: {thePrinterError}",1);
- SysBeep(); SysBeep(); SysBeep();
- twitch(previousApp);
- end;
- end;
-
- #########################################################################
- # task SelectDesktopPrinter( pSelection, v_level )
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a desktop printer by typing its name on the desktop and makes
- # it the default if it is not already. If more options are given,
- # ensures that the printer is the right type, zone, printer, etc.
- # Parameters: pSelection:
- # List of two required items in the Get Info window:
- # [1]: String name of printer file to select
- # [2]: List of optional Get Info description fields;
- # see VerifyGetInfo() task for details.
- # (can be an empty list)
- # v_level: verbosity level for log output
- # Returns: true if it was successfully selected and made default
- # false if printer could not be found or could not be made default.
- # Examples (capitalization counts when using Locate String):
- # SelectDesktopPrinter({'PDD Maker GX'});
- #
- # SelectDesktopPrinter({ 'The LaserWriter',
- # { { 'Kind', 'desktop printer'},
- # { 'Type', 'LaserWriter GX'},
- # { 'Printer', 'Black Box LW IINTX'} } });
- #
- # SelectDesktopPrinter({ 'My Direct Printer',
- # { { 'Type', 'StyleWriter GX'},
- # { 'Port', 'Modem Port'} } });
- #
- # SelectDesktopPrinter({ 'Our Favorite PrintServer',
- # { { 'Kind', 'shared desktop printer'},
- # { 'Type', 'LaserWriter GX'},
- # { 'Zone', 'Mariani 3rd'},
- # { 'Server', 'PrintLab LWII NTX'} } });
- # Assumptions: 1) Assumes that the printer(s) in question have already been created
- # on the desktop. This task does not create a desktop printer.
- # 2) Finder is in front and there are no Info windows in front.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 03/20/95 MDF created
- # 04/04/95 MDF changed gestalt to check for 0 as the version instead of 65792.
- # 04/09/95 SBR modified to go to Desktop; also checks Get Info window fields
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectDesktopPrinter( pSelection := {'LaserWriter GX',{}}, v_level := 5)
- begin
- gesResult := _Gestalt('pmgr');
- if (gesResult[1] <> 0) # if error then print manager is not installed correctly
- begin
- RError("Sorry, the GX print manager is not installed correctly.",v_level);
- return false;
- end;
- else
- try begin
- printerName := pSelection[1];
- getInfoDescription := pSelection[2];
-
- # go to Finder
- previousApp := _Match([application]).t;
- if not twitch('Finder')
- begin
- RError("Could not switch to the Finder.",v_level);
- end;
-
- # bring desktop window to front using short cut to select startup volume
- type_keys({'latch',commandKey,'latch',shiftKey,'latch',optionKey, upArrowKey});
-
- # type the name and verify the Get Info window contents
- if not VerifyGetInfo(printerName, getInfoDescription, true)
- begin
- RError("Could not find '{printerName}' or verify its Get Info window.",v_level);
- throw false;
- end;
-
- # We selected it and the specified options are correct; check for Printing menu
-
- menuState := _Match([menuItem t:"Set Default Printer" m:'Printing'], true);
- if not menuState
- begin
- RError("Could not locate 'Set Default Printer' in the 'Printing' menu.",v_level);
- throw false;
- end;
- else if menuState.c = '' # This printer is already the default.
- begin
- RStatus("The printer '{printerName}' is the default printer", v_level);
- throw true;
- end;
- else begin # This printer is not the default; make it so.
- select_menuItem("Set Default Printer","Printing");
- if not await_presence([menuItem t:"Set Default Printer" m:'Printing' c:''])
- begin
- RError("'{printerName}' did not become the default printer.",v_level);
- throw false;
- end;
- RStatus("Made '{printerName}' the default printer", v_level);
- throw true;
- end;
- end;
-
- catch theTerminator # Generic ending for this task
- begin
- #type_keys({escapeKey}); # De-select all items in the Finder
- twitch( previousApp );
- return theTerminator;
- end;
- end;
-
- (*task SelectDesktopPrinter( pSelection := {'LaserWriter GX'}, v_level := 2)
- begin
- gesResult := _Gestalt('pmgr');
- if (gesResult[2] <> 0) # if true then GX has been installed correctly
- begin
- printerType := pSelection[1];
- options := pSelection[2];
- if (options[1] = 'name')
- printerName := options[2];
- type_keys({printerName,'latch', commandKey, "i"});
-
- if not _MatchBoolean([window t:/{printerName} Info≈/ o:1], true)
- begin
- key_eq('w',,v_level);
- RError("Could not find the printer '{printerType}' with name '{printerName}' on the desktop.",v_level);
- return false;
- end;
- key_eq('w',,v_level);
-
- menuState := _Match([menuItem t:"Set Default Printer" m:'Printing'], true);
- if not (menuState.c = '') # if this printer is not the default, make it the default
- begin
- select_menuItem("Set Default Printer","Printing");
- type_keys({'down', escapeKey, 'up', escapeKey});
- RStatus("Made '{printerName}' the default printer)", v_level);
- end;
- return true;
- begin
- RError("name parameter not specified correctly.",v_level);
- return false;
- end;
- end;
- else # else, return false
- begin
- RError("Sorry, GX is not installed correctly.",v_level);
- return false;
- end;
- end;
- *)
-
- #########################################################################
- # task SelectATImageWriter(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects an AppleTalk ImageWriter by typing its name in the Chooser.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectATImageWriter({{'name',"Plodder"}});
- # SelectATImageWriter({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectATImageWriter( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectATImageWriter: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"AppleTalk ImageWriter" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectATImageWriter: AppleTalk ImageWriter is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectATImageWriter: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'AppleTalk ImageWriter', 'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"AppleTalk ImageWriter" w:1],5,,,6)
- myResult := RStatus("SelectATImageWriter: Selected AppleTalk ImageWriter in the Chooser.", v_level);
- else
- myResult := RError("SelectATImageWriter: Failed to select AppleTalk ImageWriter in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectImageWriter(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects an ImageWriter by clicking on the modem port icon.*
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectImageWriter({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # We can only use the modem port as if we are to use the
- # printer port then we'll have to turn off Appletalk.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectImageWriter( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectImageWriter: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"ImageWriter" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectImageWriter: ImageWriter is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectImageWriter: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'ImageWriter'}, 5);
- move_mouse({{340, 180}, 'rtw', 'click'});
- type_keys({'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"ImageWriter" w:1],5,,,6)
- myResult := RStatus("SelectImageWriter: Selected ImageWriter in the Chooser.", v_level);
- else
- myResult := RError("SelectImageWriter: Failed to select ImageWriter in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectLaserWriter(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a LaserWriter by typing its name in the Chooser.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectLaserWriter({{'name',"Plodder"}});
- # Examples: SelectLaserWriter({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 09/15/94 SBR created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectLaserWriter( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectLaserWriter: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"LaserWriter Page Setup" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectLaserWriter: LaserWriter is already the current printer type.", v_level);
- end;
-
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectLaserWriter: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'LaserWriter', 'latch', commandKey, 'q'}, 5);
- typeSpeed(saveSpeed);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
-
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"LaserWriter Page Setup" w:1],5,,,6)
- myResult := RStatus("SelectLaserWriter: Selected LaserWriter in the Chooser.", v_level);
- else
- myResult := RError("SelectLaserWriter: Failed to select LaserWriter in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectLaserWriter300(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a LaserWriter300 by clicking on the modem port icon.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectLaserWriter300({{'name',"Plodder"}});
- # SelectLaserWriter300({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectLaserWriter300( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectLaserWriter300: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"LaserWriter 300 Page Setup" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectLaserWriter300: LaserWriter 300 is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectLaserWriter300: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'LaserWriter 300'}, 5);
- move_mouse({{300, 70}, 'rtw', 'click'});
- type_keys({'latch', commandkey, 'q'}, 5);
- typeSpeed(saveSpeed);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
-
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"LaserWriter 300 Page Setup" w:1],5,,,6)
- myResult := RStatus("SelectLaserWriter300: Selected LaserWriter 300 in the Chooser.", v_level);
- else
- myResult := RError("SelectLaserWriter300: Failed to select LaserWriter 300 in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectLaserWriter8(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a LaserWriter 8 by typing its name in the Chooser.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectLaserWriter8({{'name',"Plodder"}});
- # Examples: SelectLaserWriter8({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 09/15/94 SBR created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectLaserWriter8( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectLaserWriter8: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"LaserWriter 8 Page Setup" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectLaserWriter8: LaserWriter 8 is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectLaserWriter8: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'LaserWriter 8', 'latch', commandKey, 'q'}, 5);
- typeSpeed(saveSpeed);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
-
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"LaserWriter 8 Page Setup" w:1],5,,,6)
- myResult := RStatus("SelectLaserWriter8: Selected LaserWriter 8 in the Chooser.", v_level);
- else
- myResult := RError("SelectLaserWriter8: Failed to select LaserWriter 8 in the Chooser.",1);
-
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectLWSelect310(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects an LW Select 310 by clicking on the modem port icon.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectLWSelect310({{'name',"Plodder"}});
- # Examples: SelectLWSelect310({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectLWSelect310( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectLWSelect310: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"LW Select 310 Page Setup" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectLWSelect310: LW Select 310 is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectLWSelect310: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'LaserWriter 300'}, 5);
- move_mouse({{340, 180}, 'rtw', 'click'});
- type_keys({'latch', commandKey, 'q'}, 5);
- typeSpeed(saveSpeed);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
-
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"LW Select 310 Page Setup" w:1],5,,,6)
- myResult := RStatus("SelectLWSelect310: Selected LW Select 310 in the Chooser.", v_level);
- else
- myResult := RError("SelectLWSelect310: Failed to select LW Select 310 in the Chooser.",1);
-
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectLQATImageWriter(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects an LQ AppleTalk ImageWriter by typing its name in the Chooser.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectLQATImageWriter({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectLQATImageWriter( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectLQATImageWriter: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"AppleTalk ImageWriter LQ" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectLQATImageWriter: LQ AppleTalk ImageWriter is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectLQATImageWriter: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'LQ AppleTalk', 'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"AppleTalk ImageWriter LQ" w:1],5,,,6)
- myResult := RStatus("SelectLQATImageWriter: Selected LQ AppleTalk ImageWriter in the Chooser.", v_level);
- else
- myResult := RError("SelectLQATImageWriter: Failed to select LQ AppleTalk ImageWriter in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectLQImageWriter(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects an LQ ImageWriter by clicking on the modem port icon.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectLQImageWriter({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # We can only use the modem port as if we are to use the
- # printer port then we'll have to turn off Appletalk.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectLQImageWriter( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectLQImageWriter: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"LQ ImageWriter" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectLQImageWriter: LQ ImageWriter is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectLQImageWriter: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys({'LQ ImageWriter'}, 5);
- move_mouse({{340, 180}, 'rtw', 'click'});
- type_keys({'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"LQ ImageWriter" w:1],5,,,6)
- myResult := RStatus("SelectLQImageWriter: Selected LQ ImageWriter in the Chooser.", v_level);
- else
- myResult := RError("SelectLQImageWriter: Failed to select LQ ImageWriter in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectPersonalLaserWriterSC(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a Personal LaserWriter SC by typing its name in the Chooser.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectPersonalLaserWriterSC({{'name',"Plodder"}});
- # SelectPersonalLaserWriterSC({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectPersonalLaserWriterSC( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectPersonalLaserWriterSC: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"Personal LaserWriter SC" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectPersonalLaserWriterSC: Personal LaserWriter SC is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectPersonalLaserWriterSC: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
-
- # The 'SC' part of 'Personal LaserWriter SC' is left out as the wrong printer is selected when this is left in.
- type_keys({'Personal LaserWriter', 'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"Personal LaserWriter SC" w:1],5,,,6)
- myResult := RStatus("SelectPersonalLaserWriterSC: Selected Personal LaserWriter SC in the Chooser.", v_level);
- else
- myResult := RError("SelectPersonalLaserWriterSC: Failed to select Personal LaserWriter SC in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectPersonalLWLS(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a Personal LW LS by clicking on the modem port icon.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectPersonalLWLS({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # We can only use the modem port as if we are to use the
- # printer port then we'll have to turn off Appletalk.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectPersonalLWLS( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectPersonalLWLS: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"Personal LW LS" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectPersonalLWLS: Personal LW LS is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectPersonalLWLS: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
-
- # The 'LS' part of 'Personal LW LS' is left out as the wrong printer is selected when this is left in.
- type_keys ({'Personal LW'});
- move_mouse({{340, 180}, 'rtw', 'click'});
- type_keys({'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"Personal LW LS" w:1],5,,,6)
- myResult := RStatus("SelectPersonalLWLS: Selected Personal LW LS in the Chooser.", v_level);
- else
- myResult := RError("SelectPersonalLWLS: Failed to select Personal LW LS in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectStyleWriter(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a StyleWriter by clicking on the modem port icon.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectStyleWriter({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # We can only use the modem port as if we are to use the
- # printer port then we'll have to turn off Appletalk.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectStyleWriter( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectStyleWriter: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"StyleWriter" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectStyleWriter: StyleWriter is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectStyleWriter: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys ({'StyleWriter'});
- move_mouse({{340, 180}, 'rtw', 'click'});
- type_keys({'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"StyleWriter" w:1],5,,,6)
- myResult := RStatus("SelectStyleWriter: Selected StyleWriter in the Chooser.", v_level);
- else
- myResult := RError("SelectStyleWriter: Failed to select StyleWriter in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectStyleWriterII(pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects a StyleWriter II by clicking on the modem port icon.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pOptions: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectStyleWriterII({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # We can only use the modem port as if we are to use the
- # printer port then we'll have to turn off Appletalk.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 01/06/95 Tony Clancy created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectStyleWriterII( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectStyleWriterII: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"StyleWriter II" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectStyleWriter: StyleWriter II is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectStyleWriterII: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys ({'StyleWriter II'});
- move_mouse({{300, 70}, 'rtw', 'click'});
- type_keys({'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"StyleWriter II" w:1],5,,,6)
- myResult := RStatus("SelectStyleWriterII: Selected StyleWriter II in the Chooser.", v_level);
- else
- myResult := RError("SelectStyleWriterII: Failed to select StyleWriter II in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
- #########################################################################
- # task SelectColorSW2400(pSettings, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects the Color StyleWriter 2400 by clicking on the modem port icon.
- # Verifies by selecting Page Setup in the Finder and
- # checking staticText items in the dialog.
- # Parameters: pSettings: list optional settings, e.g. name, setup paramters
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectColorSW2400({});
- # Assumptions: WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # We can only use the modem port as if we are to use the
- # printer port then we'll have to turn off Appletalk.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 09/05/95 MSO created, based on SelectStyleWriterII task by Tony Clancy
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectColorSW2400( pOptions, v_level := 5)
- begin
- if not select_menuItem('Page Setup…', 'File')
- return RError("SelectColorSW2400: could not select Page Setup… from the Finder File menu", 1);
- await_presence([window s:dialog o:1],,,,6);
-
- if _MatchBoolean([staticText t:"Color StyleWriter 2400 Page Setup" w:1], true)
- begin
- type_keys({returnKey});
- return RStatus("SelectColorSW2400: Color StyleWriter 2400 is already the current printer type.", v_level);
- end;
- else
- begin
- type_keys({returnKey});
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return RError("SelectColorSW2400: Failed to open the Chooser.",v_level);
- saveSpeed := typeSpeed(50);
- type_keys ({'Color SW 2400'});
- move_mouse({{300, 70}, 'rtw', 'click'});
- type_keys({'latch', commandkey, 'q'}, 5);
- if await_presence ([staticText t:/You have changed your current printer.≈/ o:3
- w:[window o:1 s:dialog] ],5,,,6)
- type_keys({returnKey});
- await_presence ([application t:'Finder'],,,,6);
- select_menuItem('Page Setup…', 'File');
- if await_presence([staticText t:"Color StyleWriter 2400 Page Setup" w:1],5,,,6)
- myResult := RStatus("SelectColorSW2400: Selected Color StyleWriter 2400 in the Chooser.", v_level);
- else
- myResult := RError("SelectColorSW2400: Failed to select Color StyleWriter 2400 in the Chooser.",1);
- type_keys({returnKey});
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
- end;
-
-
- #########################################################################
- # task SelectLaserWriterGX( pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects the LaserWriter GX as the default GX printer.
- # Verifies by using SelectDesktopPrinter() task.
- # Parameters: pOptions: list of settings
- # [1]: String name of file on desktop
- # (default to 'LaserWriter GX')
- # [2]: List of optional Get Info Description fields;
- # see VerifyGetInfo() task for details (can be empty)
- # [3]: List of optional LaserWriter GX setting details;
- # currently unused (can be empty)
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectLaserWriterGX({"The Printer Name"});
- # Assumptions: 1) WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # 2) Finder is the front application
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 06/01/96 MSO created, based on SelectPDDMakerGX by SBR (Radar 1293559)
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SelectLaserWriterGX( pOptions := {}, v_level := 5)
- begin
- if (card pOptions) = 0
- pOptions := pOptions + {'LaserWriter GX'};
- while (card pOptions) < 3
- pOptions := pOptions + {{}};
-
- printerFileName := pOptions[1];
- printerGetInfoDescription := pOptions[2] + {{ 'Type', 'LaserWriter GX'}};
- printerSetupDetails := pOptions[3];
-
- if SelectDesktopPrinter( {printerFileName, printerGetInfoDescription} )
- return {0, "SelectLaserWriterGX: LaserWriter GX is the default desktop printer"};
-
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return {-1, RError("SelectLaserWriterGX: Failed to open the Chooser.",v_level)};
-
- #chooserRect := _Match([window o:1]).r;
- try
- match[window o:1 r:?chooserRect];
- catch theError
- ExceptionDispatcher(theError,,{"Match 1 in SelectLaserWriterGX", { pOptions, v_level}});
-
- saveSpeed := typeSpeed(50);
- type_keys ({'LaserWriter GX'});
- typeSpeed(saveSpeed);
-
- wait(1);
- if not LocateString('LaserWriter GX', chooserRect, 'Geneva', 9, 0,
- {65535, 65535, 65535}, {0, 0, 0})
- return {-1, RError("SelectLaserWriterGX: LaserWriter GX is not in the Chooser.",v_level)};
-
- wait(2);
- clickMe := LocateString(printerFileName, chooserRect, 'Geneva', 12, 0);
- if isUndefined(clickMe)
- clickMe := LocateString(printerFileName, chooserRect, 'Geneva', 12, 0,
- {65535, 65535, 65535}, {0, 0, 0});
- if isUndefined(clickMe)
- return {-1, RError("SelectLaserWriterGX: {printerFileName} is not in the Chooser.",v_level)};
- else
- move_mouse({'absolute',{(clickMe[1] + clickMe[3])/2,(clickMe[2] + clickMe[4])/2},
- 'click'});
-
- if not await_presence([button t:'Create' e:true],,,,6)
- return {-1, RError("SelectLaserWriterGX: Create button not enabled in the Chooser.",v_level)};
- type_keys ({returnKey},5);
-
- if not await_presence([button t:'Setup' e:true],,,,6)
- return {-1, RError("SelectLaserWriterGX: Setup button not enabled in the Automatic setup dlog box.",v_level)};
- select_descriptor([button t:'Setup']);
-
- if not await_presence([window t:'Chooser' o:1],,,,6)
- return {-1, RError("SelectLaserWriterGX: Chooser window did not return.",v_level)};
-
- type_keys({'latch', commandkey, 'q'}, 5);
- await_presence ([application t:'Finder'],,,,6);
-
- type_keys({'latch',commandKey,'latch',shiftKey,'latch',optionKey, upArrowKey});
-
- # verify the new LaserWriter GX icon
- if not VerifyGetInfo(printerFileName,, true)
- begin
- RError("Could not find '{printerFileName}' LaserWriter GX printer.",v_level);
- return {-1};
- end;
-
- if SelectDesktopPrinter( {printerFileName, printerGetInfoDescription} )
- myResult := RStatus("SelectLaserWriterGX: Created LaserWriter GX on the desktop.", v_level);
- else
- myResult := RError("SelectLaserWriterGX: Failed to create LaserWriter GX on the desktop.",1);
-
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
-
-
- #########################################################################
- # task SelectColorSW2400GX( pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects the Color SW 2400 GX as the default GX printer.
- # Verifies by using SelectDesktopPrinter() task.
- # Parameters: pOptions: list of settings
- # [1]: String name of file on desktop
- # (default to 'Color SW 2400 GX')
- # [2]: List of optional Get Info Description fields;
- # see VerifyGetInfo() task for details (can be empty)
- # [3]: List of optional Color SW 2400 GX setting details;
- # currently unused (can be empty)
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectColorSW2400GX({"The Printer Name"});
- # Assumptions: 1) WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # 2) Finder is the front application
- # 3) Selecting the modem port as if we are to use the
- # printer port then we'll have to turn off Appletalk.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 06/01/96 MSO created, based on SelectPDDMakerGX by SBR (Radar 1293546)
- #########################################################################
- task SelectColorSW2400GX( pOptions := {}, v_level := 5)
- begin
- if (card pOptions) = 0
- pOptions := pOptions + {'Color SW 2400 GX'};
- while (card pOptions) < 3
- pOptions := pOptions + {{}};
-
- printerFileName := pOptions[1];
- printerGetInfoDescription := pOptions[2] + {{ 'Type', 'Color SW 2400 GX'}};
- printerSetupDetails := pOptions[3];
-
- if SelectDesktopPrinter( {printerFileName, printerGetInfoDescription} )
- return {0, "SelectColorSW2400GX: Color SW 2400 GX is the default desktop printer"};
-
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return {-1, RError("SelectColorSW2400GX: Failed to open the Chooser.",v_level)};
-
- chooserRect := _Match([window o:1]).r;
-
- saveSpeed := typeSpeed(50);
- type_keys ({'Color SW 2400 GX'});
- typeSpeed(saveSpeed);
-
- wait(1);
- if not LocateString('Color SW 2400 GX', chooserRect, 'Geneva', 9, 0,
- {65535, 65535, 65535}, {0, 0, 0})
- return {-1, RError("SelectColorSW2400GX: Color SW 2400 GX is not in the Chooser.",v_level)};
-
- wait(2);
- clickMe := LocateString('Modem Port', chooserRect, 'Geneva', 9, 0);
- if isUndefined(clickMe)
- clickMe := LocateString('Modem Port', chooserRect, 'Geneva', 9, 0,
- {65535, 65535, 65535}, {0, 0, 0});
- if isUndefined(clickMe)
- return {-1, RError("SelectColorSW2400GX: Modem Port is not in the Chooser.",v_level)};
- else
- move_mouse({'absolute',{(clickMe[1] + clickMe[3])/2,(clickMe[2] + clickMe[4])/2},
- 'click'});
-
- if not await_presence([button t:'Create' e:true],,,,6)
- return {-1, RError("SelectColorSW2400GX: Create button not enabled in the Chooser.",v_level)};
- type_keys ({returnKey},5);
- wait (2);
-
- type_keys({'latch', commandkey, 'q'}, 5);
- await_presence ([application t:'Finder'],,,,6);
-
- type_keys({'latch',commandKey,'latch',shiftKey,'latch',optionKey, upArrowKey});
-
- # select the new Color SW 2400 GX icon so we can change its name
- if not VerifyGetInfo('Color SW 2400 GX',, true)
- begin
- RError("Could not find '{printerFileName}' Color StyleWriter 2400 GX printer.",v_level);
- return {-1};
- end;
-
- # type the new name for this Color SW 2400 GX icon
- type_keys({returnKey, printerFileName, returnKey});
-
- if SelectDesktopPrinter( {printerFileName, printerGetInfoDescription} )
- myResult := RStatus("SelectColorSW2400GX: Created Color SW 2400 GX on the desktop.", v_level);
- else
- myResult := RError("SelectColorSW2400GX: Failed to create Color SW 2400 GX on the desktop.",1);
-
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
-
-
- #########################################################################
- # task SelectPDDMakerGX( pOptions, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Selects the PDD Maker GX as the default GX printer.
- # Verifies by using SelectDesktopPrinter() task.
- # Parameters: pOptions: list of settings
- # [1]: String name of file on desktop
- # (default to 'PDD Maker GX')
- # [2]: List of optional Get Info Description fields;
- # see VerifyGetInfo() task for details (can be empty)
- # [3]: List of optional PPD Maker GX setting details;
- # currently unused (can be empty)
- # v_level: verbosity level for log output
- # Returns: { theErr, "theErrString" }
- # Examples: SelectPDDMakerGX();
- # Assumptions: 1) WARNING: This task does not check if an RDEV is
- # available before trying to select it. It could select
- # something you do not want. You can not "unselect".
- # 2) Finder is the front application
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 04/09/95 SBR created
- #########################################################################
- task SelectPDDMakerGX( pOptions := {}, v_level := 5)
- begin
- if (card pOptions) = 0
- pOptions := pOptions + {'PDD Maker GX'};
- while (card pOptions) < 3
- pOptions := pOptions + {{}};
-
- printerFileName := pOptions[1];
- printerGetInfoDescription := pOptions[2] + {{ 'Type', 'PDD Maker GX'}};
- printerSetupDetails := pOptions[3];
-
- if SelectDesktopPrinter( {printerFileName, printerGetInfoDescription} )
- return {0, "SelectPDDMakerGX: PDD Maker GX is the default desktop printer"};
-
- if not (select_menuItem('Chooser', 1) and await_presence ([window t:'Chooser' o:1],,,,6))
- return {-1, RError("SelectPDDMakerGX: Failed to open the Chooser.",v_level)};
-
- chooserRect := _Match([window o:1], true).r;
-
- saveSpeed := typeSpeed(50);
- type_keys ({'PDD Maker GX'});
- typeSpeed(saveSpeed);
-
- wait(1);
- if not LocateString('PDD Maker GX', chooserRect, 'Geneva', 9, 0,
- {65535, 65535, 65535}, {0, 0, 0})
- return {-1, RError("SelectPDDMakerGX: PDD Maker GX is not in the Chooser.",v_level)};
-
- clickMe := LocateString('PDDMaker', chooserRect, 'Geneva', 9, 0);
- if isUndefined(clickMe)
- clickMe := LocateString('PDDMaker', chooserRect, 'Geneva', 9, 0,
- {65535, 65535, 65535}, {0, 0, 0});
- if isUndefined(clickMe)
- return {-1, RError("SelectPDDMakerGX: PDDMaker is not in the Chooser.",v_level)};
- else
- move_mouse({'absolute',{(clickMe[1] + clickMe[3])/2,(clickMe[2] + clickMe[4])/2},
- 'click'});
-
- if not await_presence([button t:'Create' e:true],,,,6)
- return {-1, RError("SelectPDDMakerGX: Create button not enabled in the Chooser.",v_level)};
-
- type_keys({returnKey,'latch', commandkey, 'q'}, 5);
- await_presence ([application t:'Finder'],,,,6);
-
- type_keys({'latch',commandKey,'latch',shiftKey,'latch',optionKey, upArrowKey});
-
- # select the new PDD Maker GX icon so we can change its name
- if not VerifyGetInfo('PDD Maker GX',, true)
- begin
- RError("Could not find 'PDD Maker GX' to set its name to '{printerFileName}'.",v_level);
- return {-1};
- end;
-
- # type the new name for this PDD Maker GX icon
- type_keys({returnKey, printerFileName, returnKey});
-
- if SelectDesktopPrinter( {printerFileName, printerGetInfoDescription} )
- myResult := RStatus("SelectPDDMakerGX: Created PDD Maker GX on the desktop.", v_level);
- else
- myResult := RError("SelectPDDMakerGX: Failed to create PDD Maker GX on the desktop.",1);
-
- if myResult
- return {0, myResult};
- else
- return {-1, myResult};
- end;
-
-
-
-
- (*_______________________________________________________________________________*)
- task ensure_screen_depth( depthList := {}, v_level := 5 )
- (*
- Description: If not already at a depth in the list, attempt to set depth to
- the first value in the list, then 2nd, etc.
- Parameters: depthList: list of integers, limited to { 1,2,4,8,16,24,32 }.
- Returns: { originalDepth, newDepth }
- or {} if could not set to any of the values in the list
- Change History:
- 01/17/93 SBR Created
- *)
- begin
- originalDepth := VUAid('GetDepth');
- if isMember(originalDepth, depthList)
- return { originalDepth, originalDepth };
- println "Depth is {originalDepth}, not {depthList}.";
- i := 1;
- done := false;
- while not done and i <= card depthList begin
- newDepth := depthList[i];
- if isUndefined(VUAid('setDepth', {newDepth})) return {};
- if newDepth = VUAid('GetDepth') begin
- done := true;
- if select_menuItem('Calculator','') begin #redraw menu bar
- wait(1);
- key_eq('q');
- end;
- return { originalDepth, newDepth };
- end;
- i := i + 1;
- end;
- return {};
- end;
-
-
-
- #########################################################################
- # task sys_vers(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Get the version of the system software running on the
- # target machine.
- # Parameters: v_level: verbosity level for log output
- # Returns: string compressed by removing periods, since it will be
- # used to name files, etc.
- # Returns empty string on failure.
- # Examples: println sys_vers();
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 07/25/90 Alan Liu Creation as part of GestaltLib.vu for 007
- # 03/04/92 Jason Marsh Incorporated into Clouseau.Lib
- # 09/03/94 SBR Added error handling for target access
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task sys_vers(v_level:=5)
- begin
- long_vers := _Match([system]).v;
- if long_vers
- begin
- (*abbreviate the version string*)
- vers := "";
- long_versLen := card long_vers;
- for i := 1 to long_versLen
- begin
- if (long_vers[i] = '(')
- vers := vers + '-';
- else
- if not (long_vers[i] = '.' or long_vers[i] = ')')
- vers := vers + long_vers[i];
- end;
- end;
- else vers := '';
- RStatus("sys_vers: {vers}",v_level);
- return vers;
- end;
-
-
- #########################################################################
- # task VerifyGetInfo( pGetInfoFields, typeSelectItem, v_level )
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Does a Get Info for an item in the front window of the Finder.
- # Parameters: pFileName: String name of file to verify (required)
- # pGetInfoFields: List of zero or more items comprising
- # a Get Info window description:
- # A Get Info window description consists of fields;
- # each field has two parts, the field ID and the
- # field contents, and are checked using the VU 2.1
- # built-in LocateString() task. The field ID is located
- # first in Geneva 9 bold, and if there, the field contents
- # are located to its right in Geneva 9 plain. All specified
- # field lists must match or the verify fails.
- # typeSelectItem: true: type the item name to select it
- # false: item is already selected (default)
- # v_level: verbosity level for log output
- # Returns: true: file name and all specified field matches
- # false: name or field mismatch
- # Examples (capitalization counts when using Locate String):
- # VerifyGetInfo('this file');
- #
- # VerifyGetInfo( 'that file',
- # {{ 'Kind', 'document'} });
- #
- # VerifyGetInfo( 'a clip of text',
- # {{ 'Kind', 'text clipping'},
- # { 'Version', 'n/a'} });
- # Assumptions: VU 2.1; Finder is in front; Item's container is open and in front;
- # Item is selected already (if typeSelectItem is false);
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 04/09/95 SBR Created
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task VerifyGetInfo( pFileName, pGetInfoFields := {}, typeSelectItem := false, v_level := 5 )
- begin
- lastField := card pGetInfoFields;
-
- # type the name if needed
- if typeSelectItem
- type_keys({pFileName});
-
- # open Get Info window
- type_keys({'latch', commandKey, "i"});
- if not _MatchBoolean([window t:/{pFileName} Info≈/ o:1], true)
- begin
- key_eq('w',,v_level);
- RError("Could not find a file named '{pFileName}' in the front window.",v_level);
- return false;
- end;
-
- # Check specified options
- if lastField > 1
- begin
- try
- match [window o:1 r:?theInfoWindRect];
- catch theError
- ExceptionDispatcher(theError,,{"Match 1 in VerifyGetInfo", { pFileName, pGetInfoFields, typeSelectItem, v_level}});
-
- for thisField := 1 to lastField
- begin
- tFieldID := pGetInfoFields[thisField][1];
- tFieldContents := pGetInfoFields[thisField][2];
-
- theFieldRect := LocateString(tFieldID, theInfoWindRect, 'Geneva', 9, 1);
- if not theFieldRect
- begin
- key_eq('w',,v_level); # Close Get Info Window
- RError("Could not locate Get Info field '{tFieldID}' for this file.",v_level);
- return false;
- end;
-
- theFieldRect[3] := theFieldRect[3] + 130; # Extend search rect to the right
-
- theFieldRect := LocateString(tFieldContents, theFieldRect, 'Geneva', 9, 0);
- if not theFieldRect
- begin
- key_eq('w',,v_level); # Close Get Info Window
- RError("Could not locate '{tFieldContents}' in field '{tFieldID}'.",v_level);
- return false;
- end;
- end;
- end;
-
- key_eq('w',,v_level); # Close Get Info Window
- return true;
- end;
-
-
- #########################################################################
- # task CheckExternalToolVersions(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Checks for the existence and correct versions of various external
- # tools on the target and host. isVUAidInstalled() will automatically
- # turn on Program Linking and set Guest access if needed. These are
- # all the required external tools. If they are not correct, exit script.
- # This task should be called VERY early to save the operator some time
- # if a tool is not there or is the wrong version.
- # Parameters: none
- # Returns: none - exits if unsuccsessful, returns to caller if successful
- # Examples: CheckExternalToolVersions();
- # Assumptions: External tool libraries are declared in the file containing this task.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 09/07/94 SBR Created
- # 08/08/95 SBR No longer quits "bad" tools, Radar 1275491
- # 08/27/96 BRL Updated FileTool version reference
- # Removed FileTool OnTarget version reference/tool calls
- # 09/27/96 BRL/MSO Added SPEC exception handling
- # 01/27/97 SBR Use a STR# resource to store valid versions
- # 01/27/97 SBR Changed notification string from AutoGuest 2.0 to 2.1
- # 01/27/97 SBR Added FileToolHost, AEPost, Arbitrator, Ivy checks
- #########################################################################
- task CheckExternalToolVersions(v_level := 2)
- begin
- RStatus("CheckExternalToolVersions: begin checking for required external tools...",v_level);
- saveCmdExcptn := commandExceptions(true); # turn on try-throw-catch in VU 2.1
-
- # Get all allowed XTool versions from the STR# resources in this file.
- # Build full lists now, in case we need to use them in a failure report.
- VUAidVersionRsrc := 128;
- FileToolVersionRsrc := 129;
- OnTargetVersionRsrc := 130;
- AEPostVersionRsrc := 131;
- ArbitratorVersionRsrc := 132;
- IvyVersionRsrc := 133;
-
- #thisFile := FileOfTask();
-
- VUAidVersions := {};
- tIndex := 1;
- aGoodVersion := GetIndString( VUAidVersionRsrc, tIndex (*, thisFile*) );
- while aGoodVersion
- begin
- VUAidVersions := VUAidVersions + {aGoodVersion};
- tIndex := tIndex + 1;
- aGoodVersion := GetIndString( VUAidVersionRsrc, tIndex (*, thisFile*) );
- end;
-
- FileToolVersions := {};
- tIndex := 1;
- aGoodVersion := GetIndString( FileToolVersionRsrc, tIndex (*, thisFile*) );
- while aGoodVersion
- begin
- FileToolVersions := FileToolVersions + {aGoodVersion};
- tIndex := tIndex + 1;
- aGoodVersion := GetIndString( FileToolVersionRsrc, tIndex (*, thisFile*) );
- end;
-
- OnTargetVersions := {};
- tIndex := 1;
- aGoodVersion := GetIndString( OnTargetVersionRsrc, tIndex (*, thisFile*) );
- while aGoodVersion
- begin
- OnTargetVersions := OnTargetVersions + {aGoodVersion};
- tIndex := tIndex + 1;
- aGoodVersion := GetIndString( OnTargetVersionRsrc, tIndex (*, thisFile*) );
- end;
-
- AEPostVersions := {};
- tIndex := 1;
- aGoodVersion := GetIndString( AEPostVersionRsrc, tIndex (*, thisFile*) );
- while aGoodVersion
- begin
- AEPostVersions := AEPostVersions + {aGoodVersion};
- tIndex := tIndex + 1;
- aGoodVersion := GetIndString( AEPostVersionRsrc, tIndex (*, thisFile*) );
- end;
-
- ArbitratorVersions := {};
- tIndex := 1;
- aGoodVersion := GetIndString( ArbitratorVersionRsrc, tIndex (*, thisFile*) );
- while aGoodVersion
- begin
- ArbitratorVersions := ArbitratorVersions + {aGoodVersion};
- tIndex := tIndex + 1;
- aGoodVersion := GetIndString( ArbitratorVersionRsrc, tIndex (*, thisFile*) );
- end;
-
- IvyVersions := {};
- tIndex := 1;
- aGoodVersion := GetIndString( IvyVersionRsrc, tIndex (*, thisFile*) );
- while aGoodVersion
- begin
- IvyVersions := IvyVersions + {aGoodVersion};
- tIndex := tIndex + 1;
- aGoodVersion := GetIndString( IvyVersionRsrc, tIndex (*, thisFile*) );
- end;
-
- VUAidReturnLongIntegers(true); # Each time it is launched, set it to return long integers
-
- #Let this task turn on Program Linking for us outside the try-throw-catch block
- if not isVUAidInstalled(true)
- begin
- RStatus("Can not initialize the VUAid external tool on the target.",1);
- RStatus("The compatible versions of this external tool are: {VUAidVersions}.",1);
- RStatus("Target Preparation:",1);
- RStatus("Turn on Program Linking in the Sharing Setup Control Panel.",1);
- RStatus("Enable Program Linking for <Guest> in the Users & Groups Control Panel.",1);
- RStatus("Host Preparation:",1);
- RStatus("Install the AutoGuest INIT 2.1 Extension and restart, if it is not already installed.",1);
- RStatus("If these steps do not work, rebuild the desktop on the host and target.",1);
- RStatus(" Exiting script…",1);
- exit;
- end;
-
- try
- begin
- ### Check VUAid version on the target.
- if VUAidVersions
- begin
- VUAidTargetVersion := VUAid('GetToolVersion')[2];
- VUAid('quit');
- if typeOf(VUAidTargetVersion) = 'list'
- VUAidTargetVersion := VUAidTargetVersion[2];
-
- versionMatch := false;
-
- maxIndex := card VUAidVersions;
- for strIndex := 1 to maxIndex
- begin
- aGoodVersion := VUAidVersions[strIndex];
- versionMatch := ( (VUAidTargetVersion ~= /≈{aGoodVersion}≈/) or
- (VUAidTargetVersion ~= /≈{aGoodVersion}≈∂n≈/) );
- if versionMatch
- maxIndex := 0; # terminate the for loop early
- end;
-
- if not versionMatch
- begin
- throw { 'VUAid', 'target', 'version', VUAidVersions, VUAidTargetVersion};
- end;
- else
- begin
- RStatus("VUAid version '{aGoodVersion}' launched correctly on the target.",v_level + 1);
- end;
- end;
-
-
- ### Check FileTool version on the target.
- if FileToolVersions
- begin
- try
- begin
- toolInitRtnVal := FileTool('initialize', true);
- if toolInitRtnVal[1] <> 0
- throw toolInitRtnVal;
- end;
- catch theError
- throw { 'FileTool', 'target', 'initialize', FileToolVersions, undefined, theError};
-
- FileToolTargetVersion := FileTool('GetToolVersion')[2];
- FileTool('quit');
- if typeOf(FileToolTargetVersion) = 'list'
- FileToolTargetVersion := FileToolTargetVersion[2];
-
- versionMatch := false;
-
- maxIndex := card FileToolVersions;
- for strIndex := 1 to maxIndex
- begin
- aGoodVersion := FileToolVersions[strIndex];
- versionMatch := ( (FileToolTargetVersion ~= /≈{aGoodVersion}≈/) or
- (FileToolTargetVersion ~= /≈{aGoodVersion}≈∂n≈/) );
- if versionMatch
- maxIndex := 0; # terminate the for loop early
- end;
-
- if not versionMatch
- begin
- throw { 'FileTool', 'target', 'version', FileToolVersions, FileToolTargetVersion};
- end;
- else
- begin
- RStatus("FileTool version '{aGoodVersion}' launched correctly on the target.",v_level + 1);
- end;
-
-
- ### Check FileToolHost version on the host.
- try
- begin
- toolInitRtnVal := FileToolHost('initialize', false);
- if toolInitRtnVal[1] <> 0
- throw toolInitRtnVal;
- end;
- catch theError
- throw { 'FileToolHost', 'host', 'initialize', FileToolVersions, undefined, theError};
-
- FileToolHostVersion := FileToolHost('GetToolVersion')[2];
- #FileToolHost('quit'); #Don't quit: another script might be using this...
- if typeOf(FileToolHostVersion) = 'list'
- FileToolHostVersion := FileToolHostVersion[2];
-
- versionMatch := false;
-
- maxIndex := card FileToolVersions;
- for strIndex := 1 to maxIndex
- begin
- aGoodVersion := FileToolVersions[strIndex];
- versionMatch := ( (FileToolHostVersion ~= /≈{aGoodVersion}≈/) or
- (FileToolHostVersion ~= /≈{aGoodVersion}≈∂n≈/) );
- if versionMatch
- maxIndex := 0; # terminate the for loop early
- end;
-
- if not versionMatch
- begin
- throw { 'FileToolHost', 'host', 'version', FileToolVersions, FileToolHostVersion};
- end;
- else
- begin
- RStatus("FileToolHost version '{aGoodVersion}' launched correctly on the host.",v_level + 1);
- end;
- end;
-
-
- ### Check OnTarget version on the target.
- if OnTargetVersions
- begin
- try
- begin
- toolInitRtnVal := OnTarget('initialize', true);
- if toolInitRtnVal[1] <> 0
- throw toolInitRtnVal;
- end;
- catch theError
- throw { 'OnTarget', 'target', 'initialize', OnTargetVersions, undefined, theError};
-
- OnTargetVersion := OnTarget('GetToolVersion')[2];
- OnTarget('quit');
- if typeOf(OnTargetVersion) = 'list'
- OnTargetVersion := OnTargetVersion[2];
-
- versionMatch := false;
-
- maxIndex := card OnTargetVersions;
- for strIndex := 1 to maxIndex
- begin
- aGoodVersion := OnTargetVersions[strIndex];
- versionMatch := ( (OnTargetVersion ~= /≈{aGoodVersion}≈/) or
- (OnTargetVersion ~= /≈{aGoodVersion}≈∂n≈/) );
- if versionMatch
- maxIndex := 0; # terminate the for loop early
- end;
-
- if not versionMatch
- begin
- throw { 'OnTarget', 'target', 'version', OnTargetVersions, OnTargetVersion};
- end;
- else
- begin
- RStatus("OnTarget version '{aGoodVersion}' launched correctly on the target.",v_level + 1);
- end;
- end;
-
-
- ### Check AEPost version on the host.
- if AEPostVersions
- begin
- try
- begin
- toolInitRtnVal := AEPost('initialize', false);
- if toolInitRtnVal[1] <> 0
- throw toolInitRtnVal;
- end;
- catch theError
- throw { 'AEPost', 'host', 'initialize', AEPostVersions, undefined, theError};
-
- AEPostVersion := AEPost('GetToolVersion')[2];
- #AEPost('quit'); #Don't quit: another script might be using this...
- if typeOf(AEPostVersion) = 'list'
- AEPostVersion := AEPostVersion[2];
-
- versionMatch := false;
-
- maxIndex := card AEPostVersions;
- for strIndex := 1 to maxIndex
- begin
- aGoodVersion := AEPostVersions[strIndex];
- versionMatch := ( (AEPostVersion ~= /≈{aGoodVersion}≈/) or
- (AEPostVersion ~= /≈{aGoodVersion}≈∂n≈/) );
- if versionMatch
- maxIndex := 0; # terminate the for loop early
- end;
-
- if not versionMatch
- begin
- throw { 'AEPost', 'host', 'version', AEPostVersions, AEPostVersion};
- end;
- else
- begin
- RStatus("AEPost version '{aGoodVersion}' launched correctly on the host.",v_level + 1);
- end;
- end;
-
-
- ### Check Arbitrator version on the host.
- if ArbitratorVersions
- begin
- try
- begin
- toolInitRtnVal := Arbitrator('initialize', false);
- if toolInitRtnVal[1] <> 0
- throw toolInitRtnVal;
- end;
- catch theError
- throw { 'Arbitrator', 'host', 'initialize', ArbitratorVersions, undefined, theError};
-
- ArbitratorVersion := Arbitrator('GetToolVersion')[2];
- #Arbitrator('quit'); #Don't quit: another script might be using this...
- if typeOf(ArbitratorVersion) = 'list'
- ArbitratorVersion := ArbitratorVersion[2];
-
- versionMatch := false;
-
- maxIndex := card ArbitratorVersions;
- for strIndex := 1 to maxIndex
- begin
- aGoodVersion := ArbitratorVersions[strIndex];
- versionMatch := ( (ArbitratorVersion ~= /≈{aGoodVersion}≈/) or
- (ArbitratorVersion ~= /≈{aGoodVersion}≈∂n≈/) );
- if versionMatch
- maxIndex := 0; # terminate the for loop early
- end;
-
- if not versionMatch
- begin
- throw { 'Arbitrator', 'host', 'version', ArbitratorVersions, ArbitratorVersion};
- end;
- else
- begin
- RStatus("Arbitrator version '{aGoodVersion}' launched correctly on the host.",v_level + 1);
- end;
- end;
-
-
- ### Check Ivy version on the target.
- if IvyVersions
- begin
- try
- begin
- toolInitRtnVal := Ivy('initialize', true);
- if toolInitRtnVal[1] <> 0
- throw toolInitRtnVal;
- end;
- catch theError
- throw { 'Ivy', 'target', 'initialize', IvyVersions, undefined, theError};
-
- IvyVersion := Ivy('GetToolVersion')[2];
- Ivy('quit');
- if typeOf(IvyVersion) = 'list'
- IvyVersion := IvyVersion[2];
-
- versionMatch := false;
-
- maxIndex := card IvyVersions;
- for strIndex := 1 to maxIndex
- begin
- aGoodVersion := IvyVersions[strIndex];
- versionMatch := ( (IvyVersion ~= /≈{aGoodVersion}≈/) or
- (IvyVersion ~= /≈{aGoodVersion}≈∂n≈/) );
- if versionMatch
- maxIndex := 0; # terminate the for loop early
- end;
-
- if not versionMatch
- begin
- throw { 'Ivy', 'target', 'version', IvyVersions, IvyVersion};
- end;
- else
- begin
- RStatus("Ivy version '{aGoodVersion}' launched correctly on the target.",v_level + 1);
- end;
- end;
- end;
- catch theErr
- begin
- toolName := theErr[1];
- toolLoc := theErr[2];
- whatFailed := theErr[3];
- goodVersion := theErr[4];
- thisVersion := theErr[5];
- ToolInitRtnVal := theErr[6];
-
- RError("TTES Automated Scripts require the '{toolName}' external tool on the {toolLoc}.",1);
- if whatFailed = 'initialize'
- begin
- RError("{toolName} failed to initialize on the {toolLoc}.",1);
- if not isUndefined(ToolInitRtnVal)
- RError("The error value returned was {ToolInitRtnVal}.",1);
- RError("You may need to rebuild the desktop on the {toolLoc}.",1);
- end;
- else if whatFailed = 'version'
- begin
- RError("The version just launched on the target is '{thisVersion}'.",1);
- RError("The compatible versions of this external tool are: {goodVersion}.",1);
- RError("You need to throw away version '{thisVersion}'.",1);
- end;
- RStatus(" Exiting script…",1);
- exit;
- end;
-
- commandExceptions( saveCmdExcptn ); # revert state of try-throw-catch
- end;
-
-
-
- #########################################################################
- # task SetUpGeneralControls(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Turns off the shutdown warning that sits there blocking
- # Agent VU for 5 minutes after a crash. See Radar #1122664.
- # Also sets default standard file to the application's folder
- # Parameters: v_level
- # Returns: none - exits if unsuccessful, returns to caller if successful
- # The task exits gracefully if there is no General Controls CP,
- # or if the System is older than 7.5, or if the checkbox is not
- # found in the General Controls CP.
- # Examples: SetUpGeneralControls();
- # Assumptions: VU 2.1 (control ordinality), General Controls CP 7.5.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 02/22/95 SBR Created as TurnOffShutDownWarning
- # 07/26/95 SBR changed to SetUpGeneralControls
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task SetUpGeneralControls(v_level := 4)
- begin
- # [checkBox t:'Warn me if computer was shut down improperly' o:46 r: { 38, 192, 278, 208 } e:true s:{ 0, 1 } h:0]
- # [radioButton t:'Documents folder.' o:47 r: { 273, 288, 463, 304 } e:true s:{ 0, 1 } h:0]
- # [radioButton t:'Last folder used in the application.' o:48 r: { 273, 271, 463, 287 } e:true s:{ 0, 1 } h:0]
- # [radioButton t:'Folder which contains the application.' o:49 r: { 273, 254, 463, 270 } e:true s:{ 1, 1 } h:0]
-
- RStatus("SetUpGeneralControls: Setting default folder and turning off shut down warning…",v_level);
-
- SavePreviousAppName := _Match([application ]).t;
- noFrontDialog := true;
- finderTwitchOK := twitch('Finder'); # Get to Finder, without a dialog
- if not finderTwitchOK
- RError("SetUpGeneralControls: Could not switch to Finder, is a dialog in front?", 2);
-
- else if ( _MatchBoolean( [window o:1 s:dialog], true)
- or _MatchBoolean( [window o:1 s:movablemodal], true))
- begin
- noFrontDialog := dismiss_dialog();
- end;
-
- if finderTwitchOK and noFrontDialog
- begin
- closeCP := not _MatchBoolean([window t:'General Controls'
- k:{[checkBox t:'Warn me if computer was shut down improperly' o:46]}],true);
- if not open_control_panel('General Controls',true) # Close window behind
- return;
- select_descriptor([checkBox t:/Warn me≈/ o:46 e:true s:{ 1, 1 }],1); # Shutdown warning
- select_descriptor([radioButton t:'Folder which contains the application.' o:49
- e:true s:{ 0, 1 }],1); # Default standard file directory
- if closeCP
- close_window();
-
- twitch(SavePreviousAppName);
- end;
- else
- RError("SetUpGeneralControls: Could turn on Program Linking, is a dialog in front?", 2);
-
- end;
-
-
- #########################################################################
- # task reset(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: attempts to dismiss any dialogs, close all windows, etc.
- # If it fails, it aborts the script.
- # Parameters: v_level: verbosity level for log output
- # Returns: Nothing
- # Examples: reset();
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # ??? ??? Created
- # 12/03/96 Masa changed call to abort_script(). Radar 1185040
- #########################################################################
- task reset(v_level := 5)
- begin
- type_keys({returnKey});
- key_eq("w",5,v_level);
- if await_presence([window t:"Desktop" o:1]!,,,,6) return true;
-
- dismiss_dialog();
- type_keys({returnKey});
- key_eq("w",5,v_level);
- if await_presence([window t:"Desktop" o:1]!,,,,6) return true;
-
- twitch("Finder");
- key_eq("w",5,v_level);
- if await_presence([window t:"Desktop" o:1]!,,,,6) return true;
-
- abort_script("reset: Aborting script after failure to dismiss dialogs, close windows, etc.");
- end;
-
-
- #########################################################################
- # task target_info(v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: prints out vital target information to the log
- # Parameters: v_level: verbosity level for log info.
- # Returns: Nothing
- # Examples: target_info();
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 04/12/92 Jason Marsh Created
- # 4/19/94 Alan Winslow Fixed Gestalt "addr" bug (temp treated as string
- # instead of integer)
- # 09/03/94 SBR use target_machine since target_cpu was deleted
- # 09/13/94 SBR VU 2.1 Gestalt returns long integers; made changes for this.
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task target_info(v_level:= 2)
- begin
- global vm, ThirtyTwoBit;
-
- cpuName := target_machine(v_level)[1];
- RStatus("target_cpu: ∂'{cpuName}∂'", v_level);
-
- sys_vers(v_level);
-
- if _Gestalt( "mmu ")[2] = 0
- vm := 'not available';
- else if _Gestalt( "vm ")[2] = 1
- vm := 'on';
- else vm := 'off';
- RStatus("vm: {vm}", v_level);
-
- temp := _Gestalt( "addr")[2];
- if temp = 0
- ThirtyTwoBit:= "not available";
- else if temp = 7
- ThirtyTwoBit := "on";
- else ThirtyTwoBit:= "off";
- RStatus ("32 bit: {ThirtyTwoBit}", v_level);
-
- ram := _Match([target], false).r; # Amount of memory of the target machine
- RStatus ("Ram: {ram}");
-
- end;
-
-
- #########################################################################
- # task CPUstic()
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Looks at target CPU and check for the CPU's memory
- # capabilities. (i.e., VM, 32-bits, and RAM Disk)
- # Parameters: None
- # Returns: A list specifying the CPU's memory capabilities:
- # {VM, 32-bit, RAM disk}
- # Examples: CPUMemory := CPUstic();
- # Assumptions: None
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 04/14/92 Richard Sheng Created
- # 03/30/94 Gary Kratzer Added Modern Memory Manager check.
- # 09/13/94 SBR VU 2.1 Gestalt returns long integers; made changes for this.
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task CPUstic()
- begin
- if _Gestalt("mmu ")[2] > 1
- vmAvail := true;
- else
- vmAvail := false;
-
- if _Gestalt("addr")[2] = 0
- addressing := false;
- else
- addressing := true;
-
- temp := _Gestalt("mach")[2];
- if temp > 19 and temp <> 23
- RamDisk := true;
- else
- RamDisk:= false;
-
- temp := _Gestalt("cput");
- if temp[1] = 0
- begin
- if temp[2] >= 257 # If PowerPC 601 or greater (0x101 = PPC601)
- MMMgr := true;
- end;
- else # If cput isn't implemented, must be a 680x0
- MMMgr := false;
-
- return {vmAvail,addressing, RamDisk, MMMgr};
- end;
-
-
- #########################################################################
- # task restart_target(restart_flag, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Restart the target machine. This assumes we are in the
- # Finder already, and returns a false value on failure.
- # After restarting, it waits for the machine to respond
- # before returning to the caller.
- # Parameters: v_level: verbosity level for log output
- # Returns: Nothing
- # Examples: restart_target();
- # Assumptions: Target machine is in finder;
- # no unsaved documents are open to prevent shutdown
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 7/25/90 Alan Liu Creation as part of FinderLib.vu for 007
- # 3/4/92 Jason Marsh Incorporated into Clouseau.Lib
- # 12/15/93 JDL Added await presence for application 'finder'
- # after target is found; documented assumptions
- # 09/03/94 SBR Added quit_all(), and error handling for target access
- # 09/27/96 BRL/MSO Added SPEC exception handling
- # 04/17/97 SBR Fixed Radar 1377545 (Special menu ordinality).
- #########################################################################
- task restart_target(v_level := 5)
- begin
- Err := false; #no error to begin with
-
- RStatus("restart_target: attempting to restart target...",2);
-
- theTarget := _Match([actor], true).u ;
- if not theTarget
- begin
- RError("restart_target: there is no target to restart!",2);
- return true;
- end;
-
- tName := theTarget.t;
- tZone := theTarget.z;
-
- # Only the Finder can be running to restart, for re-aquire to work.
- # We can not yet watch the applications close as they go by.
- quit_all(v_level);
-
- # Special menu is named funny with dev systems, have to use menu ordinality.
- # With System 8.x, the Special menu is ordinality 5. In System 7.x it is o:6.
- if _MatchBoolean( [menuItem t:'Restart' m:[menu o:5]], true)
- specialMenu := 5;
- else if _MatchBoolean( [menuItem t:'Restart' m:[menu o:6]], true)
- specialMenu := 6;
- else
- specialMenu := 0;
-
- if specialMenu
- begin
- try
- begin
- select [menuItem t:'Restart' m:[menu o:specialMenu]];
- releaseTarget(true); # Must release target IMMEDIATELY after selecting Restart
- # Otherwise the target may be gone already - preventing
- # successful reacquisition. Can't use select_menuitem.
- end;
- catch theError
- ExceptionDispatcher(theError,,{"select in restart_target", {v_level}});
-
- RStatus("Selected menu item 'Restart' in menu o:{specialMenu}",v_level);
-
- count := 0;
- while not (acqResult = 0 or count >= 5)
- begin
- wait(10);
- count := count + 1;
- acqResult := acquireTarget(tName, tZone);
- if acqResult = 2 acqResult := 0;
- if (acqResult <> 0)
- RStatus("attempt {count} to acquire ∂"{tName}∂", result = {acqResult}",v_level);
- end;
- if count >= 5
- Err := true;
- (*wait for the target to start up again*)
- _Match ([target t:tName z:tZone]); # update host model of the target
-
- await_presence([application t:"Finder"],30,5);
- end;
- else
- Err := true;
-
- if Err
- RIncomplete("failed", v_level);
- else
- RStatus("succeeded",v_level);
- return Err;
- end;
-
- #########################################################################
- # task EH_CrashRecover(theError, parameterList, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Standard error handler for -1100, -1104, or -1096 ScriptError() result.
- # This is intended to be used with the EveryTime macro in MacsBug, which
- # creates a MacsBug log. If expectedApp is Boolean true, ignore the app name
- # but check for the MacsBug log.
- # Parameters: theError: error that caused this handler to be called
- # parameterList: internally defined parameters for this handler
- # { expectedApp: list of possible apps which might be in front
- # if we recovered from a "slow target crash"
- # minTime: minimum time to wait before each retry
- # maxTime: maximum time to wait for multiple retries
- # }
- # v_level: verbosity level for log output
- # Returns: report string
- # Assumptions: VU 2.1, VUAid 2.1, FileTool, reset_target_info() was called
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 06/12/93 SBR Created
- # 09/03/94 SBR Modified to use VU 2.1 - No NetworkRetries()
- # 03/12/95 SBR Modified to use VU 2.1 - error -1096, target restarted
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task EH_CrashRecover(theError, parameterList := {'',5,15}, v_level := 4)
- begin
- global gMacsBugLogsFolder, gCurrentError;
-
- RStatus("EH_CrashRecover: error is {theError}, parameterList is {parameterList}.",v_level);
-
- expectedApp := parameterList[1];
- #minTime := parameterList[2]; #SBR 01/06/94: commented out for VM Stress
- #maxTime := parameterList[3]; #SBR 01/06/94: commented out for VM Stress
-
- tName := get_target_info('name'); # can not use match; use stored values
- tZone := get_target_info('zone');
-
- try
- targetDesc := match[target t:tName z:tZone];
- catch theError
- if theError <> -1105
- ExceptionDispatcher(theError,,{"Match 1 in EH_CrashRecover", {theError, parameterList, v_level}});
-
- if not targetDesc
- begin
- crashed := "target failure (error = {theError})";
- RError("EH_CrashRecover: {crashed}", v_level);
- RStatus("EH_CrashRecover: TARGET '{tName}' CRASHED! WAITING FOR RESTART TO CONTINUE THE SCRIPT…",1);
- end;
- else if theError = -1096
- begin
- # -1096 means target restarted. VU 2.1 checks for this explicitly for each command
-
- crashed := "target restarted unexpectedly (error = {theError})";
- RError("EH_CrashRecover: {crashed}", v_level);
- RStatus("EH_CrashRecover: TARGET '{tName}' RESTARTED UNEXPECTEDLY!",1);
- end;
- else
- begin
- RStatus( "EH_CrashRecover: Target recovered within " +
- "EH_CrashRecover({theError}, {parameterList}, {v_level})", v_level);
- RStatus( "EH_CrashRecover: Target descriptor is: {targetDesc}", v_level);
-
- crashed := "target failed and then recovered (error = {theError})";
-
- RError("EH_CrashRecover: {crashed}", v_level);
- RStatus("EH_CrashRecover: TARGET '{tName}' FAILED AND THEN RECOVERED!",1);
- end;
-
- releaseTarget(true);
-
- acqResult := acquireTarget(tName, tZone);
- while not (acqResult = 0)
- begin
- SysBeep();
- wait(20);
- acqResult := acquireTarget(tName, tZone);
- if acqResult = 2
- acqResult := 0;
- end;
-
- #for cleanliness, restart the CPU
- RStatus("EH_CrashRecover: crashed target '{tZone}:{tName}' reaquired, restarting…", 1);
- twitch('Finder');
-
- # Wait for Desktop, i.e. Finder finishes launch, or else key_eq('w',5) is taken as "rebuild Desktop"
- desktopDescriptor := [window r:{0,0,0,0}];
- if not await_presence(desktopDescriptor, 60)
- RIncomplete("{desktopDescriptor} did not appear in 60 seconds",1);
- key_eq('w',5); # close all windows
-
- mbLogName := MacsBugLog(expectedApp);
- if mbLogName
- RStatus("EH_CrashRecover: MacsBug log is named {mbLogName}", 1);
-
- if restart_target()
- abort_script('EH_CrashRecover: the target did not restart properly');
- else
- begin
- setMacsBugMacro('restore'); # restore the MacsBug EveryTime macro
- end;
-
- return crashed;
- end;
-
- #########################################################################
- # task setMacsBugMacro(theMacro, createLog, closeAndRestart, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Uses VUAid 2.0 DebugStr service to set the MacsBug EveryTime macro.
- # Parameters: theMacro: A string of valid MacsBug commands, each followed by ';'.
- # Keep it short, MacsBug is unforgiving for long macros!
- # Also, avoid commands that produce more than a
- # screen full of output, or MacsBug will stop and ask
- # for a key press to continue auto-scrolling.
- # 'clear': special value; clear the EveryTime macro
- # 'read': special value; read the stored macro
- # 'restore': special value; restore EveryTime after restart
- # createLog: true: log to "{startupVol}:{MBLogName}" while executing theMacro
- # false: execute theMacro directly without logging
- # closeAndRestart: true: restart (close log if necessary)
- # false: allows tester to explore crashes manually
- # v_level: verbosity level for reporting
- # Returns: macro is set: the EveryTime macro as currently stored, or,
- # 'clear' for a cleared EveryTime macro
- # macro is not set: false or undefined
- # Examples: setMacsBugMacro('ap;how;wh;ip;td;log;rs;');
- # setMacsBugMacro('clear'); (clears the EveryTime macro)
- # setMacsBugMacro('restore'); (restores macro to previous setting)
- # setMacsBugMacro('',true,false); (macro will open a blank log and wait)
- # Assumptions: VU 2.1; no other volume has same name as startup volume
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 06/12/93 SBR Created
- # 03/22/94 SBR Changed so 'clear' is stored as 'clear' instead of empty string
- # 09/03/94 SBR Added error handling for target access.
- # Uses VU 2.1 built-in DebugStr() task instead of VUAid.
- # 08/14/95 SBR Create a folder for new logs, see Radar 1277101.
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task setMacsBugMacro(theMacro := '', createLog := true, closeAndRestart := true, v_level := 2)
- begin
- global g_EveryTime_Macro; # the secret global which holds the Macro
-
- if theMacro = 'read'
- return g_EveryTime_Macro;
-
- if theMacro = 'clear' # special case for 'clear'
- g_EveryTime_Macro := theMacro;
-
- else if theMacro = 'restore'
- begin
- if isUndefined(g_EveryTime_Macro)
- begin
- RError("You tried to 'restore' the MacsBug macro to an undefined value.",v_level);
- return false;
- end;
- end;
- else
- begin # build a new macro and store it in g_EveryTime_Macro
- g_EveryTime_Macro := theMacro;
-
- if createLog
- begin
- startUpVol := get_target_info('startupVolume');
- mbLogName := get_target_info('MacsBugLogName');
-
- # Create a folder for new logs, see Radar 1277101.
- mbLogPath := "{startUpVol}:MacsBug Logs (new):{mbLogName}";
-
- g_EveryTime_Macro := "log ∂"{mbLogPath}∂";" + g_EveryTime_Macro;
- if closeAndRestart
- g_EveryTime_Macro := g_EveryTime_Macro + "log;";
- end;
-
- if closeAndRestart
- g_EveryTime_Macro := g_EveryTime_Macro + "rs;";
- end;
-
- if g_EveryTime_Macro = 'clear' # special case for 'clear'
- theMacroString := ";mc EveryTime '';g;";
- else # normal case for set and 'restore'
- theMacroString := ";mc EveryTime '{g_EveryTime_Macro}';set scrollprompt off;g;";
-
- _DebugStr( theMacroString, true );
-
- return g_EveryTime_Macro;
- end;
-
-
- #########################################################################
- # task MacsBugLog(theName, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Locate a file named "{mbLogName}" in the root directory of the
- # startup volume. If it exists, rename it "{thisHour} {theName}", and
- # move it to "{startupVol}:MacsBug logs:{target} {thisMonth}/{thisDay}:".
- # Folders are created if necessary.
- # Parameters: theName: anything but 'delete': rename and move as defined
- # 'delete': special value to delete "{mbLogName}"
- # v_level: verbosity level for reporting
- # Returns: new file name if successful, false if not
- # Examples: MacsBugLog('TeachText 7.1');
- # Assumptions: VU 2.1; no other volume has same name as startup volume;
- # FileTool is on the Target and launchable any time.
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 06/12/93 SBR Created
- # 07/19/93 SBR Removes trailing '@' to prevent spurious finds
- # 09/03/94 SBR Added error handling for target access
- # Use get_target_info instead of startUpVolWindow
- # 09/17/96 BRL Fixed error with folder name > 31 chars
- # 09/27/96 BRL/MSO Added SPEC exception handling
- #########################################################################
- task MacsBugLog(theName := '', v_level := 4)
- begin
- # Check if a macsbug log exists
-
- try
- match [mouse];
- catch theError
- if theError <> -1105
- ExceptionDispatcher(theError,,{"Match 1 in MacsBugLog()", {theName}});
-
- temp := FileTool('initialize', true);
- if temp[1]
- return RIncomplete("MacsBugLog: could not initialize FileTool");
-
- startupVolume := get_target_info('startupVolume');
- mbLogName := get_target_info('MacsBugLogName');
- mbLogPath := get_target_info('MacsBugLogPath');
-
- # If a log exists, rename it and move it to the logs folder
- if FileExists("{mbLogPath}:{mbLogName}")[2]
- begin
- if theName = 'delete' # delete the log
- begin
- DeleteFile("{mbLogPath}:{mbLogName}");
- theName := '';
- end;
- else
- begin
- if not FileExists("{startupVolume}:MacsBug logs")[2]
- CreateFolder("{startupVolume}:MacsBug logs");
-
- try
- match [time m:?thisMonth d:?thisDay h:?thisHour];
- catch theError
- ExceptionDispatcher(theError,,{"match in MacsBugLog()", {theName, v_level}});
-
- tName := get_target_info('name');
- if not tName tName := actorName();
- mbLogsFolder := "{startupVolume}:MacsBug logs:{tName} {thisMonth}/{thisDay}";
-
- if not FileExists("{mbLogsFolder}")[2]
- CreateFolder("{mbLogsFolder}");
-
- thisHour := "{thisHour}"; # pad to 4 characters
- thisHourLen := card thisHour;
- for i := 1 to 4 - thisHourLen
- thisHour := '0' + thisHour;
-
- if not theName
- theName := "MacsBug Log for ??";
- theName := "{thisHour} {theName}";
- nameLength := card theName;
-
- if theName[nameLength] = '@' # remove '@' to prevent app mis-find
- begin
- nameLength := nameLength - 1;
- removeLastChar := true;
- end;
-
- if nameLength > 31 # if file name > 31, remove middle
- tooLong := true;
-
- if tooLong or removeLastChar # for speed, process only if necessary
- begin
- nameCopy := '';
- for i := 1 to nameLength
- begin
- if tooLong
- begin
- if (i <= 20) or (i > 25)
- nameCopy := nameCopy + theName[i];
- end;
- else nameCopy := nameCopy + theName[i];
- end;
- theName := nameCopy;
- end;
-
- MoveFile("{mbLogPath}:{mbLogName}","{mbLogsFolder}:{theName}" );
- end;
- end;
- else theName := '';
-
- FileTool('quit');
- return theName;
- end;
-
-
- #########################################################################
- # task EnableProgramLinking(pEnabled, pGuest, v_level)
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # Description: Starts Program Linking. Also enables program linking for
- # Guest users, if pGuest is true.
- # Parameters: pEnabled: true: start program linking
- # false: stop program linking
- # pGuest: true: turn on guest access
- # false: turn off guest access
- # undefined: ignore guest access (may be on or off)
- #
- # v_level: verbosity level for reporting
- # Returns: true if successful, false if not
- # Examples: EnableProgramLinking(true, true);
- # Assumptions:
- #∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
- # History:
- # 03/12/97 SBR Created
- # 04/07/97 SBR Updated for 8.0a5c6
- # 05/30/97 SBR Added pEnabled parameter.
- #########################################################################
- task EnableProgramLinking(pEnabled := true, pGuest := undefined, v_level := 4)
- begin
- tSuccess := true;
-
- if pEnabled
- begin
- tStr1 := "About to start";
- tBeginStr := "Start";
- tEndStr := "Stop";
- end;
- else begin
- tStr1 := "About to stop";
- pGuest := undefined;
- tBeginStr := "Stop";
- tEndStr := "Start";
- end;
-
- if isUndefined(pGuest)
- begin
- tStr2 := "ignoring";
- end;
- else if pGuest
- begin
- tStr2 := "enabling";
- tBeginVal := {0,1};
- tEndVal := {1,1};
- end;
- else
- begin
- tStr2 := "disabling";
- tBeginVal := {1,1};
- tEndVal := {0,1};
- end;
-
- sysVersion := _Match([system]).v;
- if (sysVersion ~= /≈7.0≈/) or (sysVersion ~= /≈7.1≈/) or (sysVersion ~= /≈7.5≈/) or
- (sysVersion ~= /≈7.6≈/)
- begin
- newSharing := 0; # Sharing Setup CP (controls visible)
- end;
- else if ((sysVersion ~= /≈7.7a2≈/) or (sysVersion ~= /≈7.7a3≈/) or
- (sysVersion ~= /≈8.0a4≈/))
- begin
- newSharing := 1; # File Sharing CP (controls invisible to VU)
- end;
- else #if (sysVersion ~= /≈8.0a5≈/) #See Radar 1646166.
- begin
- newSharing := 2; # File Sharing CP (controls visible, not selectable)
- end;
- # else # One day we might be able to use VU normally here.
- # begin
- # newSharing := 3; # File Sharing CP (controls visible and selectable)
- # end;
-
- RStatus("{tStr1} Program Linking (type {newSharing}), {tStr2} guest access...",v_level);
-
- SavePreviousAppName := _Match([application ]).t;
-
- noFrontDialog := true;
- finderTwitchOK := twitch('Finder'); # Get to Finder, without a dialog
- if not finderTwitchOK
- begin
- tSuccess := false;
- RError("TurnOnProgramLinking: Could not switch to Finder, is a dialog in front?", 2);
- end;
- else
- begin
- if ( _MatchBoolean( [window o:1 s:dialog], true)
- or _MatchBoolean( [window o:1 s:movablemodal], true))
- begin
- noFrontDialog := dismiss_dialog();
- end;
- end;
-
- if finderTwitchOK and noFrontDialog
- begin
- if newSharing
- begin
- _Match([screen]); # Prepare for LocateString()
-
- SetTextOptions( { {"Charcoal",12}, {"Chicago",12}, {"Truth",12}} );
-
- open_control_panel("File Sharing",false); # Do not close Control Panels window
-
- # Switch panels back and forth to stabilize control ordinalities.
- key_eq('tmt'); # Switch to Start/Stop tab
-
- wBounds := _Match([window o:1]).b; # Limit searches to window bounds rect
-
- # Get the search rectangle for the Program Linking Start/Stop button
- tRect := AwaitText({"Program Linking", wBounds},3);
- searchRect := {tRect[1], tRect[2], tRect[3], tRect[4] + 100};
-
- switch newSharing
- begin
- case 1:
- begin
- # System 7.7a4 and earlier builds: controls were invisible to VU
-
- tRect := LocateText({tEndStr, searchRect});
- if not tRect
- begin
- tRect := LocateText({tBeginStr, searchRect});
- if not tRect
- begin
- RError("Could not determine if Program Linking is on or off.");
- tSuccess := false;
- end;
- else
- begin
- move_mouse( { 'absolute',tRect,'click' } );
- if not AwaitText({tEndStr, searchRect},20)
- begin
- RError("Program Linking still off, 20 seconds after clicking {tBeginStr}.");
- tSuccess := false;
- end;
- end;
- end;
- end;
- case 2:
- begin
- # System 8.0(7.7)a5 and later builds: controls are visible to VU
- # Unfortunately, they are not selectable. Radar 1646166.
-
- if _MatchBoolean([button t:tBeginStr o:4]) # Program linking button
- begin
- tRect := LocateText({tBeginStr, searchRect});
- move_mouse( { 'absolute',tRect,'click' } );
- end;
-
- if not await_presence([button t:tEndStr o:4],20) # Changes name for on/off
- begin
- RError("Program Linking unchanged 20 seconds after clicking {tBeginStr}.");
- tSuccess := false;
- end;
- end;
- default:
- begin
- # System 8.0(7.7)a6? and later builds: controls are controllable by VU
- # We will assume this case does not exist until it is proven to exist.
-
- select_descriptor([button t:tBeginStr o:4]); # Program linking button
-
- if not await_presence([button t:tEndStr o:4],20) # Changes name for on/off
- begin
- RError("Program Linking unchanged 20 seconds after clicking {tBeginStr}.");
- tSuccess := false;
- end;
- end;
- end;
- key_eq('w'); # Close File Sharing
-
- if not isUndefined(pGuest)
- begin
- open_control_panel("Users & Groups"); # Close Control Panels window
-
- type_keys({'Guest', 'latch', commandKey, 'o'});
-
- await_presence([window t:"Guest" o:1]);
- wBounds := _Match([window]).b;
-
- # Select "Sharing" from the popup.
- move_mouse( {'absolute', LocateText({"Identity", wBounds}) } );
- _PressMouse();
- wait(0,0,0,500);
- move_mouse( {'absolute', AwaitText({"Sharing", wBounds}) } );
- wait(0,0,0,250);
- _ReleaseMouse();
- wait(0,0,0,500);
-
- switch newSharing
- begin
- case 1:
- begin
- # System 7.7a4 and earlier builds: controls were invisible to VU
-
- # Assume that if we are here, Guest Program Linking is off.
- # This is because VU can't see the checkbox setting to be sure.
- move_mouse( {'absolute', AwaitText({"Allow guests to link",
- wBounds,{ {"Geneva",10} }}), 'click'} );
- end;
- case 2:
- begin
- # System 8.0(7.7)a5 and later builds: controls are visible to VU
- # Unfortunately, they are not selectable. Radar 1646166.
-
- if not _MatchBoolean([checkBox t:/Allow guests to link≈/ o:1 s:tEndVal])
- begin
- move_mouse( {'absolute', AwaitText({"Allow guests to link",
- wBounds,{ {"Geneva",10} }}), 'click'} );
- end;
- end;
- default:
- begin
- # System 8.0GM? and later builds: controls are controllable by VU
- # The normal case (not yet proven).
-
- select_descriptor(
- [checkBox t:/Allow guests to link≈/ o:1 s:tBeginVal], 1);
- end;
- end;
-
- # Close Guest then Users & Groups
- key_eq('ww');
- end;
- else
- key_eq('w'); # Close Control Panels window
- end;
- else
- begin
- # System 7.6.1 and previous
- open_control_panel('Sharing Setup',false); # Do not close Control Panels window
- select_descriptor([button t:tBeginStr o:1]); # Program linking button
- await_presence([button t:tEndStr o:1],20); # Changes name for on/off
- key_eq('w'); # Close Sharing Setup
-
- if not IsUndefined(pGuest)
- begin
- open_control_panel('Users & Groups'); # Close Control Panels window
- type_keys({'<Guest>', 'latch', commandKey, 'o'});
- select_descriptor([checkBox t:/Allow guests to link≈/ o:1 s:tBeginVal], 1);
- key_eq('w'); # Close <Guest>
- type_keys({'wait1',returnKey}); # Sure you want to Save?
- key_eq('w'); # Close Users & Groups
- end;
- else
- key_eq('w'); # Close Control Panels window
- end;
-
- twitch(SavePreviousAppName);
- return tSuccess;
- end;
- else
- return RError("EnableProgramLinking: Could not set it, is a dialog in front?", 2);
- end;
-
-
-